1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 10:43:30 +02:00
Files
archived-php-src/ext/standard/tests/streams/bug76943.phpt
T
Christoph M. Becker 5ed0602ec6 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.
2020-09-22 16:11:35 +02:00

29 lines
845 B
PHP

--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)