Skip to content

stream_is_local(): unwrap zlib and bzip2 wrappers if needed - #23714

Open
DanielEScherzer wants to merge 3 commits into
php:masterfrom
DanielEScherzer:stream_is_local
Open

DanielEScherzer wants to merge 3 commits into
php:masterfrom
DanielEScherzer:stream_is_local

Conversation

@DanielEScherzer

Copy link
Copy Markdown
Member

When a stream is wrapped with zlib:, compress.zlib://, or compress.bzip2:// (and the relevant extension is installed to apply that wrapper), remove that prefix before trying to determine if a stream is local or not.

Add tests to demonstrate that the `zlib:`, `compress.zlib://`, and
`compress.bzip2://` wrappers also result in `stream_is_local()` returning
`true`. This behavior will be changed in a subsequent commit.
When a stream is wrapped with `zlib:`, `compress.zlib://`, or
`compress.bzip2://` (and the relevant extension is installed to apply that
wrapper), remove that prefix before trying to determine if a stream is local or
not.
context = php_stream_context_from_zval(zcontext, 0);
wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(zstream), NULL, 0);

// Skip past any of `zlib:`, `compress.zlib://`, and `compress.bzip2://`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a hack, not a real fix. Now details of zlib and bzip2 leak into the standard extension.

@bukka bukka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As Nora said, this is a hack. It needs to get info from the wrapper and not doing checks by name.

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.

3 participants