Skip to content

Replace php_stream_wrapper.is_url with flags and resolve nested wrappers - #24120

Open
bukka wants to merge 1 commit into
php:masterfrom
bukka:stream_wrapper_flags
Open

bukka wants to merge 1 commit into
php:masterfrom
bukka:stream_wrapper_flags

Conversation

@bukka

@bukka bukka commented Oct 4, 2026

Copy link
Copy Markdown
Member

The compress.zlib:// and compress.bzip2:// wrappers open the path that follows their scheme through the stream layer, so whether such a stream is local depends on the inner wrapper. stream_is_local() and the openssl cafile check treated them as always local.

Replace the is_url field with a flags field. PHP_STREAM_WRAPPER_FLAG_URL keeps the value 1 so existing initializers are unchanged, and the new PHP_STREAM_WRAPPER_FLAG_NESTED marks wrappers that open the remainder of the path. php_stream_wrapper_is_url() walks nested schemes in a loop for path strings, and PHP_STREAM_FLAG_URL is set on opened streams, copied from the inner stream by nested wrappers, so php_stream_is_url() needs no lookup. The open path and the allow_url_fopen enforcement at the inner open are unchanged.

The compress.zlib:// and compress.bzip2:// wrappers open the path that
follows their scheme through the stream layer, so whether such a stream
is local depends on the inner wrapper. stream_is_local() and the openssl
cafile check treated them as always local.

Replace the is_url field with a flags field. PHP_STREAM_WRAPPER_FLAG_URL
keeps the value 1 so existing initializers are unchanged, and the new
PHP_STREAM_WRAPPER_FLAG_NESTED marks wrappers that open the remainder of
the path. php_stream_wrapper_is_url() walks nested schemes in a loop for
path strings, and PHP_STREAM_FLAG_URL is set on opened streams, copied
from the inner stream by nested wrappers, so php_stream_is_url() needs no
lookup. The open path and the allow_url_fopen enforcement at the inner
open are unchanged.

Co-authored-by: Daniel Scherzer <daniel.e.scherzer+phpf@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant