-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #76943: Inconsistent stream_wrapper_restore() errors
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. Closes GH-6183.
- Loading branch information
Showing
3 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--TEST-- | ||
Bug #76943 (Inconsistent stream_wrapper_restore() errors) | ||
--SKIPIF-- | ||
<?php | ||
if (!in_array('phar', stream_get_wrappers())) die('skip phar wrapper not registered'); | ||
?> | ||
--FILE-- | ||
<?php | ||
var_dump(stream_wrapper_restore('foo')); | ||
var_dump(stream_wrapper_restore('phar')); | ||
|
||
stream_wrapper_register('bar', 'stdClass'); | ||
|
||
var_dump(stream_wrapper_restore('foo')); | ||
var_dump(stream_wrapper_restore('phar')); | ||
?> | ||
--EXPECTF-- | ||
Warning: stream_wrapper_restore(): foo:// never existed, nothing to restore in %s on line %d | ||
bool(false) | ||
|
||
Notice: stream_wrapper_restore(): phar:// was never changed, nothing to restore in %s on line %d | ||
bool(true) | ||
|
||
Warning: stream_wrapper_restore(): foo:// never existed, nothing to restore in %s on line %d | ||
bool(false) | ||
|
||
Notice: stream_wrapper_restore(): phar:// was never changed, nothing to restore in %s on line %d | ||
bool(true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters