From: Michael Wallner Date: Fri, 25 Sep 2015 06:36:22 +0000 (+0200) Subject: gh: fix issue #12; X-Git-Tag: RELEASE_2_5_3~5 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=a0884cdb00bb323c3c793809bc39e76d46cd74d4;p=m6w6%2Fext-http gh: fix issue #12; Trying to set an invalid URL on an http\Message instance might cause a crash. --- diff --git a/php_http_message.c b/php_http_message.c index 3b19a8c..c6b03ff 100644 --- a/php_http_message.c +++ b/php_http_message.c @@ -1619,10 +1619,10 @@ static PHP_METHOD(HttpMessage, setRequestUrl) url = php_http_url_from_zval(zurl, ~0 TSRMLS_CC); zend_restore_error_handling(&zeh TSRMLS_CC); - if (php_http_url_is_empty(url)) { + if (url && php_http_url_is_empty(url)) { php_http_url_free(&url); php_http_throw(invalid_arg, "Cannot set http\\Message's request url to an empty string", NULL); - } else { + } else if (url) { PTR_SET(obj->message->http.info.request.url, url); }