From: Michael Wallner Date: Wed, 21 Dec 2005 19:49:39 +0000 (+0000) Subject: - only encode if there's anything to encode X-Git-Tag: RELEASE_0_21_0~51 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=d1121da9cad0383aa661a8d0720dd598e448400c;p=m6w6%2Fext-http - only encode if there's anything to encode --- diff --git a/http_url_api.c b/http_url_api.c index c8e9e78..575c4f5 100644 --- a/http_url_api.c +++ b/http_url_api.c @@ -299,8 +299,6 @@ PHP_HTTP_API STATUS _http_urlencode_hash_recursive(HashTable *ht, phpstr *str, c return FAILURE; } } else { - char *encoded_val; - int encoded_len; zval *cpy, *val = convert_to_type_ex(IS_STRING, *data, &cpy); if (PHPSTR_LEN(str)) { @@ -309,9 +307,14 @@ 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, "="); - encoded_val = php_url_encode(Z_STRVAL_P(val), Z_STRLEN_P(val), &encoded_len); - phpstr_append(str, encoded_val, encoded_len); - efree(encoded_val); + if (Z_STRLEN_P(val)) { + char *encoded_val; + int encoded_len; + + encoded_val = php_url_encode(Z_STRVAL_P(val), Z_STRLEN_P(val), &encoded_len); + phpstr_append(str, encoded_val, encoded_len); + efree(encoded_val); + } if (cpy) { zval_ptr_dtor(&cpy);