[php-src] PR #22245: url parsing: improve error reporting using detailed url_error codes
| From: | arshidkv12 | Date: | Sun, 07 Jun 2026 04:53:15 +0000 |
| Subject: | [php-src] PR #22245: url parsing: improve error reporting using detailed url_error codes | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36327@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22245
Author: arshidkv12
Replace generic URL parse failure warning with specific error messages
based on
php_url_parse_ex2() error codes (invalid port, trailing colon,
port too long, empty host, etc.).
```diff
+ switch (url_error) {
+ case PHP_URL_ERR_INVALID_PORT:
+ php_error_docref(NULL, E_WARNING, "Invalid port in URL");
+ break;
+ case PHP_URL_ERR_TRAILING_COLON:
+ php_error_docref(NULL, E_WARNING, "Trailing colon without port in URL");
+ break;
+ case PHP_URL_ERR_PORT_TOO_LONG:
+ php_error_docref(NULL, E_WARNING, "Port number too long in URL");
+ break;
+ case PHP_URL_ERR_EMPTY_HOST:
+ php_error_docref(NULL, E_WARNING, "Empty host in URL");
+ break;
+ default:
+ php_error_docref(NULL, E_WARNING, "Unable to parse URL");
+ break;
+ }
```