com php-src: Fix stream context changes leaking into copies of previous context: main/streams/streams.c

[email protected] (Bob Weinand)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    8be63ce0e2046e67e403f5ccd5aa06ecdd94e25c
Author:    Bob Weinand <[email protected]>         Tue, 14 Mar 2017 22:15:41 +0100
Parents:   b9d3dbc84e8de18305bb456cff500775f8abf921
Branches:  PHP-7.0

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=8be63ce0e2046e67e403f5ccd5aa06ecdd94e25c

Log:
Fix stream context changes leaking into copies of previous context

Changed paths:
  M  main/streams/streams.c


Diff:
diff --git a/main/streams/streams.c b/main/streams/streams.c
index c4cb8d8..704ab71 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -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;
 }
 /* }}} */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.