Open
Description
Description
The following code:
<?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:
- num = 0-65535 -> num gets into port and path
- num = 65536-99999 -> the function returns fasle instead of an array
- 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