diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-09-22 16:14:03 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-09-22 16:14:03 +0200 |
commit | 544dbe8ef91f21846b9b33be1352dd6d2bb43a83 (patch) | |
tree | 6a6daf7030f99c73a374c1120efdd4f5dfaf1bbb /main/streams | |
parent | 35013ac8233b6d868da98761db707f16584dc36e (diff) | |
parent | ff0f6c26c20b97e47f2bb70f631165e3a8801aac (diff) | |
download | php-git-544dbe8ef91f21846b9b33be1352dd6d2bb43a83.tar.gz |
Merge branch 'PHP-7.4' into master
* PHP-7.4:
Fix #76943: Inconsistent stream_wrapper_restore() errors
Diffstat (limited to 'main/streams')
-rw-r--r-- | main/streams/userspace.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/main/streams/userspace.c b/main/streams/userspace.c index f6381a0014..0e9059a99e 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -526,23 +526,24 @@ PHP_FUNCTION(stream_wrapper_restore) { zend_string *protocol; php_stream_wrapper *wrapper; - HashTable *global_wrapper_hash; + HashTable *global_wrapper_hash, *wrapper_hash; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &protocol) == FAILURE) { RETURN_THROWS(); } global_wrapper_hash = php_stream_get_url_stream_wrappers_hash_global(); - if (php_stream_get_url_stream_wrappers_hash() == global_wrapper_hash) { - php_error_docref(NULL, E_NOTICE, "%s:// was never changed, nothing to restore", ZSTR_VAL(protocol)); - RETURN_TRUE; - } - if ((wrapper = zend_hash_find_ptr(global_wrapper_hash, protocol)) == NULL) { php_error_docref(NULL, E_WARNING, "%s:// never existed, nothing to restore", ZSTR_VAL(protocol)); RETURN_FALSE; } + wrapper_hash = php_stream_get_url_stream_wrappers_hash(); + if (wrapper_hash == global_wrapper_hash || zend_hash_find_ptr(wrapper_hash, protocol) == wrapper) { + php_error_docref(NULL, E_NOTICE, "%s:// was never changed, nothing to restore", ZSTR_VAL(protocol)); + RETURN_TRUE; + } + /* A failure here could be okay given that the protocol might have been merely unregistered */ php_unregister_url_stream_wrapper_volatile(protocol); |