X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_url_api.c;h=07204608b1af731e721e820746e01e9c4abd5cb5;hb=3017eb87773ddee0b170d532ff92e195f2f69612;hp=575c4f57a856b63f42a06623f9ec7944b609101e;hpb=d1121da9cad0383aa661a8d0720dd598e448400c;p=m6w6%2Fext-http diff --git a/http_url_api.c b/http_url_api.c index 575c4f5..0720460 100644 --- a/http_url_api.c +++ b/http_url_api.c @@ -299,7 +299,13 @@ PHP_HTTP_API STATUS _http_urlencode_hash_recursive(HashTable *ht, phpstr *str, c return FAILURE; } } else { - zval *cpy, *val = convert_to_type_ex(IS_STRING, *data, &cpy); + zval *val; + + ALLOC_ZVAL(val); + *val = **data; + INIT_PZVAL(val); + zval_copy_ctor(val); + convert_to_string(val); if (PHPSTR_LEN(str)) { phpstr_append(str, arg_sep, arg_sep_len); @@ -307,7 +313,7 @@ PHP_HTTP_API STATUS _http_urlencode_hash_recursive(HashTable *ht, phpstr *str, c phpstr_append(str, PHPSTR_VAL(&new_prefix), PHPSTR_LEN(&new_prefix)); phpstr_appends(str, "="); - if (Z_STRLEN_P(val)) { + if (Z_STRLEN_P(val) && Z_STRVAL_P(val)) { char *encoded_val; int encoded_len; @@ -316,11 +322,8 @@ PHP_HTTP_API STATUS _http_urlencode_hash_recursive(HashTable *ht, phpstr *str, c efree(encoded_val); } - if (cpy) { - zval_ptr_dtor(&cpy); - } + zval_ptr_dtor(&val); } - phpstr_dtor(&new_prefix); } return SUCCESS;