]> granicus.if.org Git - php/commitdiff
Fix stream context changes leaking into copies of previous context
authorBob Weinand <bobwei9@hotmail.com>
Tue, 14 Mar 2017 21:15:41 +0000 (22:15 +0100)
committerBob Weinand <bobwei9@hotmail.com>
Tue, 14 Mar 2017 21:15:41 +0000 (22:15 +0100)
main/streams/streams.c

index c4cb8d824cb101187cf6946d9fe102f61b432fe1..704ab71688b3329bcba431e75c6f4d002e226875 100644 (file)
@@ -2231,6 +2231,7 @@ PHPAPI int php_stream_context_set_option(php_stream_context *context,
        zval *wrapperhash;
        zval category;
 
+       SEPARATE_ARRAY(&context->options);
        wrapperhash = zend_hash_str_find(Z_ARRVAL(context->options), wrappername, strlen(wrappername));
        if (NULL == wrapperhash) {
                array_init(&category);
@@ -2241,6 +2242,7 @@ PHPAPI int php_stream_context_set_option(php_stream_context *context,
        }
        ZVAL_DEREF(optionvalue);
        Z_TRY_ADDREF_P(optionvalue);
+       SEPARATE_ARRAY(wrapperhash);
        return zend_hash_str_update(Z_ARRVAL_P(wrapperhash), optionname, strlen(optionname), optionvalue) ? SUCCESS : FAILURE;
 }
 /* }}} */