[php-src] master: ext/uri: Fix throwing Uri\UriError
| From: | Máté Kocsis | Date: | Thu, 17 Sep 2026 20:55:48 +0000 |
| Subject: | [php-src] master: ext/uri: Fix throwing Uri\UriError | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141258@lists.php.net to get a copy of this message | ||
Author: Máté Kocsis (kocsismate)
Date: 2026-09-17T22:54:02+02:00
Commit: https://github.com/php/php-src/commit/703b5bb37a098c1c01ae314e0dbf244d9f2280cf
Raw diff: https://github.com/php/php-src/commit/703b5bb37a098c1c01ae314e0dbf244d9f2280cf.diff
ext/uri: Fix throwing Uri\UriError
Since it doesn't have an $errors property
Changed paths:
M ext/uri/uri_parser_whatwg.c
Diff:
diff --git a/ext/uri/uri_parser_whatwg.c b/ext/uri/uri_parser_whatwg.c
index acda86877ac0..8fee839b1cc4 100644
--- a/ext/uri/uri_parser_whatwg.c
+++ b/ext/uri/uri_parser_whatwg.c
@@ -736,9 +736,9 @@ static void php_uri_parser_whatwg_destroy(void *uri)
lxb_url_destroy(lexbor_uri);
}
-ZEND_ATTRIBUTE_NONNULL static void php_uri_parser_whatwg_throw_exception(zend_class_entry
*exception_ce, const char *message)
+ZEND_ATTRIBUTE_NONNULL static void php_uri_parser_whatwg_throw_exception(const char *message)
{
- zend_object *exception = zend_throw_exception(exception_ce, message, 0);
+ zend_object *exception = zend_throw_exception(php_uri_ce_whatwg_invalid_url_exception, message,
0);
zval errors;
ZVAL_EMPTY_ARRAY(&errors);
zend_update_property(exception->ce, exception, ZEND_STRL("errors"), &errors);
@@ -1043,7 +1043,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t
*php_uri_parser_wh
lxb_url_t *lexbor_url = lexbor_mraw_calloc(lexbor_parser.mraw, sizeof(*lexbor_url));
if (lexbor_url == NULL) {
- php_uri_parser_whatwg_throw_exception(php_uri_ce_error, "Memory allocation error");
+ zend_throw_exception(php_uri_ce_error, "Memory allocation error", 0);
return NULL;
}
@@ -1080,17 +1080,17 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t
*php_uri_parser_wh
|| lexbor_url->host.type == LXB_URL_HOST_TYPE_EMPTY
|| lexbor_url->scheme.type == LXB_URL_SCHEMEL_TYPE_FILE) {
if (Z_TYPE_P(username) != IS_NULL) {
- php_uri_parser_whatwg_throw_exception(php_uri_ce_whatwg_invalid_url_exception, "The
specified URL cannot have username");
+ php_uri_parser_whatwg_throw_exception("The specified URL cannot have username");
goto failure;
}
if (Z_TYPE_P(password) != IS_NULL) {
- php_uri_parser_whatwg_throw_exception(php_uri_ce_whatwg_invalid_url_exception, "The
specified URL cannot have password");
+ php_uri_parser_whatwg_throw_exception("The specified URL cannot have password");
goto failure;
}
if (Z_TYPE_P(port) != IS_NULL) {
- php_uri_parser_whatwg_throw_exception(php_uri_ce_whatwg_invalid_url_exception, "The
specified URL cannot have port");
+ php_uri_parser_whatwg_throw_exception("The specified URL cannot have port");
goto failure;
}
}