Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #76943: Inconsistent stream_wrapper_restore() errors #6183

Closed
wants to merge 1 commit into from

Conversation

cmb69
Copy link
Contributor

@cmb69 cmb69 commented Sep 22, 2020

If restoring of any not registered built-in wrapper is requested, the
function is supposed to fail with a warning, so we have to check this
condition first.

Furthermore, to be able to detect whether a built-in wrapper has been
changed, it is not sufficient to check whether any userland wrapper
has been registered, but rather whether the specific wrapper has been
modified.

If restoring of any not registered built-in wrapper is requested, the
function is supposed to fail with a warning, so we have to check this
condition first.

Furthermore, to be able to detect whether a built-in wrapper has been
changed, it is not sufficient to check whether *any* userland wrapper
has been registered, but rather whether the specific wrapper has been
modified.
@cmb69 cmb69 added the Bug label Sep 22, 2020
@ohader
Copy link

ohader commented Nov 6, 2020

How would it possible to determine whether a different stream wrapper has been registered?

stream_wrapper_restore() does not only restore unregistered (non-existing) stream wrappers, but it also reverts alternativ stream wrapper implementations back to PHP's native stream wrapper. stream_get_wrappers() just tells, whether a wrapper is registered - but it does not tell, whether it's PHP's native implementation or a custom stream wrapper.

With this change, the only way to overcome notices is to mute error output @stream_wrapper_restore().
Thanks in advance for hints or thoughts on this topic!

ohader added a commit to ohader/phar-stream-wrapper that referenced this pull request Nov 6, 2020
* since PHP 8.0-RC1
* since PHP 7.3.24
* since PHP 7.4.12
* see php/php-src@5ed0602
* see php/php-src#6183
@cmb69
Copy link
Contributor Author

cmb69 commented Nov 9, 2020

How would it possible to determine whether a different stream wrapper has been registered?

It seems to me this functionality is missing; something like stream_wrapper_get_registered($protocol) which returns the registered class name or null appears to be useful.

andreaskienast added a commit to andreaskienast/phar-stream-wrapper that referenced this pull request Nov 11, 2020
* since PHP 8.0-RC1
* since PHP 7.3.24
* since PHP 7.4.12
* see php/php-src@5ed0602
* see php/php-src#6183
ohader pushed a commit to TYPO3/phar-stream-wrapper that referenced this pull request Nov 11, 2020
* since PHP 8.0-RC1
* since PHP 7.3.24
* since PHP 7.4.12
* see php/php-src@5ed0602
* see php/php-src#6183
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants