X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=src%2Fphp_http_client.c;h=cedc239b68c1f780c2df5ef7b46b5bf74f448992;hp=7f8363ee4a69453f25d54a652813bc0f47fd619f;hb=3ee3d5f53712e1e91d4ffef34aa0c6e8f4f8840e;hpb=66a434f313d40d89a912e3044ac5d6112d4f0806 diff --git a/src/php_http_client.c b/src/php_http_client.c index 7f8363e..cedc239 100644 --- a/src/php_http_client.c +++ b/src/php_http_client.c @@ -75,6 +75,7 @@ void php_http_client_options_set_subr(zval *instance, char *key, size_t len, zva array_init(&new_opts); old_opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0, &old_opts_tmp); + if (Z_TYPE_P(old_opts) == IS_ARRAY) { array_copy(Z_ARRVAL_P(old_opts), Z_ARRVAL(new_opts)); } @@ -88,6 +89,7 @@ void php_http_client_options_set_subr(zval *instance, char *key, size_t len, zva } } else if (opts && zend_hash_num_elements(Z_ARRVAL_P(opts))) { if ((entry = zend_symtable_str_find(Z_ARRVAL(new_opts), key, len))) { + SEPARATE_ZVAL(entry); array_join(Z_ARRVAL_P(opts), Z_ARRVAL_P(entry), 0, 0); } else { Z_ADDREF_P(opts);