Skip to content

Commit 8be63ce

Browse files
committed
Fix stream context changes leaking into copies of previous context
1 parent b9d3dbc commit 8be63ce

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

main/streams/streams.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,6 +2231,7 @@ PHPAPI int php_stream_context_set_option(php_stream_context *context,
22312231
zval *wrapperhash;
22322232
zval category;
22332233

2234+
SEPARATE_ARRAY(&context->options);
22342235
wrapperhash = zend_hash_str_find(Z_ARRVAL(context->options), wrappername, strlen(wrappername));
22352236
if (NULL == wrapperhash) {
22362237
array_init(&category);
@@ -2241,6 +2242,7 @@ PHPAPI int php_stream_context_set_option(php_stream_context *context,
22412242
}
22422243
ZVAL_DEREF(optionvalue);
22432244
Z_TRY_ADDREF_P(optionvalue);
2245+
SEPARATE_ARRAY(wrapperhash);
22442246
return zend_hash_str_update(Z_ARRVAL_P(wrapperhash), optionname, strlen(optionname), optionvalue) ? SUCCESS : FAILURE;
22452247
}
22462248
/* }}} */

0 commit comments

Comments
 (0)