X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_url_api.c;h=7bacffc3e73e26120c8ddbc58e7f52ec1df63eb4;hp=07204608b1af731e721e820746e01e9c4abd5cb5;hb=6e9ea0a647db55213dd230145c35a419d7abde4d;hpb=213951e5268262c6dbea4b05b852510132f3367b diff --git a/http_url_api.c b/http_url_api.c index 0720460..7bacffc 100644 --- a/http_url_api.c +++ b/http_url_api.c @@ -27,8 +27,6 @@ #include "php_http_api.h" #include "php_http_url_api.h" -ZEND_EXTERN_MODULE_GLOBALS(http); - PHP_HTTP_API char *_http_absolute_url(const char *url TSRMLS_DC) { char *abs = estrdup(url); @@ -39,6 +37,8 @@ PHP_HTTP_API char *_http_absolute_url(const char *url TSRMLS_DC) if (purl) { http_build_url(purl, NULL, NULL, &abs, NULL); php_url_free(purl); + } else { + http_error_ex(HE_WARNING, HTTP_E_URL, "Could not parse URL (%s)", url); } return abs; @@ -299,13 +299,7 @@ PHP_HTTP_API STATUS _http_urlencode_hash_recursive(HashTable *ht, phpstr *str, c return FAILURE; } } else { - zval *val; - - ALLOC_ZVAL(val); - *val = **data; - INIT_PZVAL(val); - zval_copy_ctor(val); - convert_to_string(val); + zval *val = zval_copy(IS_STRING, *data); if (PHPSTR_LEN(str)) { phpstr_append(str, arg_sep, arg_sep_len); @@ -322,7 +316,7 @@ PHP_HTTP_API STATUS _http_urlencode_hash_recursive(HashTable *ht, phpstr *str, c efree(encoded_val); } - zval_ptr_dtor(&val); + zval_free(&val); } phpstr_dtor(&new_prefix); }