diff options
| author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-11-04 11:34:10 +0100 |
|---|---|---|
| committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-11-04 14:53:19 +0100 |
| commit | 2cab085bb37a6980b8f23a4b3c31b813ac67cda0 (patch) | |
| tree | 3db67a8c445768500b408e96dbf5667aed9f5d61 /ext/standard/url.h | |
| parent | 00ba784a2ce95e009f98e0e6d263634673a3f2e1 (diff) | |
| download | php-git-2cab085bb37a6980b8f23a4b3c31b813ac67cda0.tar.gz | |
Fix #80266: parse_url silently drops port number 0
As of commit 81b2f3e[1], `parse_url()` accepts URLs with a zero port,
but does not report that port, what is wrong in hindsight.
Since the port number is stored as `unsigned short` there is no way to
distinguish between port zero and no port. For BC reasons, we thus
introduce `parse_url_ex2()` which accepts an output parameter that
allows that distinction, and use the new function to fix the behavior.
The introduction of `parse_url_ex2()` has been suggested by Nikita.
[1] <http://git.php.net/?p=php-src.git;a=commit;h=81b2f3e5d9fcdffd87a4fcd12bd8c708a97091e1>
Closes GH-6399.
Diffstat (limited to 'ext/standard/url.h')
| -rw-r--r-- | ext/standard/url.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/standard/url.h b/ext/standard/url.h index ec925a2bd0..0e187065df 100644 --- a/ext/standard/url.h +++ b/ext/standard/url.h @@ -33,6 +33,7 @@ typedef struct php_url { PHPAPI void php_url_free(php_url *theurl); PHPAPI php_url *php_url_parse(char const *str); PHPAPI php_url *php_url_parse_ex(char const *str, size_t length); +PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, zend_bool *has_port); PHPAPI size_t php_url_decode(char *str, size_t len); /* return value: length of decoded string */ PHPAPI size_t php_raw_url_decode(char *str, size_t len); /* return value: length of decoded string */ PHPAPI zend_string *php_url_encode(char const *s, size_t len); |
