X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_message.c;h=c6b03ffe597b773ec93dea1b6c5f5f81ce473f8a;hp=b7b500b313bbea8b1308c194e14e1e653cc0b33c;hb=1bb638a357d62a0b8e5fa2822cf1ca50d16204c6;hpb=3f5da039a09164701de8638669fe6e8d4e916970 diff --git a/php_http_message.c b/php_http_message.c index b7b500b..c6b03ff 100644 --- a/php_http_message.c +++ b/php_http_message.c @@ -543,11 +543,11 @@ typedef struct php_http_message_object_prophandler { php_http_message_object_prophandler_func_t write; } php_http_message_object_prophandler_t; -static STATUS php_http_message_object_add_prophandler(const char *prop_str, size_t prop_len, php_http_message_object_prophandler_func_t read, php_http_message_object_prophandler_func_t write) { +static ZEND_RESULT_CODE php_http_message_object_add_prophandler(const char *prop_str, size_t prop_len, php_http_message_object_prophandler_func_t read, php_http_message_object_prophandler_func_t write) { php_http_message_object_prophandler_t h = { read, write }; return zend_hash_add(&php_http_message_object_prophandlers, prop_str, prop_len + 1, (void *) &h, sizeof(h), NULL); } -static STATUS php_http_message_object_get_prophandler(const char *prop_str, size_t prop_len, php_http_message_object_prophandler_t **handler) { +static ZEND_RESULT_CODE php_http_message_object_get_prophandler(const char *prop_str, size_t prop_len, php_http_message_object_prophandler_t **handler) { return zend_hash_find(&php_http_message_object_prophandlers, prop_str, prop_len + 1, (void *) handler); } static void php_http_message_object_prophandler_get_type(php_http_message_object_t *obj, zval *return_value TSRMLS_DC) { @@ -753,7 +753,7 @@ void php_http_message_object_prepend(zval *this_ptr, zval *prepend, zend_bool to } } -STATUS php_http_message_object_set_body(php_http_message_object_t *msg_obj, zval *zbody TSRMLS_DC) +ZEND_RESULT_CODE php_http_message_object_set_body(php_http_message_object_t *msg_obj, zval *zbody TSRMLS_DC) { zval *tmp = NULL; php_stream *s; @@ -819,7 +819,7 @@ STATUS php_http_message_object_set_body(php_http_message_object_t *msg_obj, zval return SUCCESS; } -STATUS php_http_message_object_init_body_object(php_http_message_object_t *obj) +ZEND_RESULT_CODE php_http_message_object_init_body_object(php_http_message_object_t *obj) { TSRMLS_FETCH_FROM_CTX(obj->message->ts); @@ -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); }