[php-src] Issue #7890: parse_url() and incorrect port definition

From: Date: Thu, 06 Jan 2022 03:58:40 +0000
Subject: [php-src] Issue #7890: parse_url() and incorrect port definition
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-238788@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/7890 Author: MioVisman ### Description The following code: ```php <?php $url = '//www.examle.com/ddd:65535/'; echo "<pre>\n"; var_export(parse_url($url)); echo "</pre>\n"; exit; ``` Resulted in this output: ``` array ( 'host' => 'www.examle.com', 'port' => 65535, 'path' => '/ddd:65535/', ) ``` But I expected this output instead: ``` array ( 'host' => 'www.examle.com', 'path' => '/ddd:65535/', ) ``` If url starts with // and path ends with :{num}/, then: 1. num = 0-65535 -> num gets into port and path 2. num = 65536-99999 -> the function returns fasle instead of an array 3. num < 0 or > 99999 -> all ok P.S. https://www.php.net/manual/ru/function.parse-url.php#122207 ### PHP Version PHP 8.1.1-Win32-vs16-x64, 7.3.33 ### Operating System Windows 7 x64

« previous php.bugs (#238788) next »