This should be better

This commit is contained in:
Xinchen Hui 2015-12-30 05:10:05 -08:00
parent 90d2f509e2
commit da028e0757
2 changed files with 2 additions and 4 deletions

View File

@ -885,7 +885,6 @@ static int parse_context_options(php_stream_context *context, zval *options)
if (Z_TYPE_P(wval) == IS_ARRAY) {
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(wval), okey, oval) {
if (okey) {
ZVAL_DEREF(oval);
php_stream_context_set_option(context, ZSTR_VAL(wkey), ZSTR_VAL(okey), oval);
}
} ZEND_HASH_FOREACH_END();

View File

@ -2244,9 +2244,8 @@ PHPAPI int php_stream_context_set_option(php_stream_context *context,
return FAILURE;
}
}
if (Z_REFCOUNTED_P(optionvalue)) {
Z_ADDREF_P(optionvalue);
}
ZVAL_DEREF(optionvalue);
Z_TRY_ADDREF_P(optionvalue);
return zend_hash_str_update(Z_ARRVAL_P(wrapperhash), optionname, strlen(optionname), optionvalue) ? SUCCESS : FAILURE;
}
/* }}} */