Bug #70942 [NEW]: parse_url for url without port and scheme, but with port-like string in url

From: Date: Thu, 19 Nov 2015 15:48:52 +0000
Subject: Bug #70942 [NEW]: parse_url for url without port and scheme, but with port-like string in url
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197334@lists.php.net to get a copy of this message
From: taco at procurios dot nl Operating system: linux PHP version: 5.6.15 Package: URL related Bug Type: Bug Bug description:parse_url for url without port and scheme, but with port-like string in url Description: ------------ When a URL without a scheme and port, but with a port-like string (e.g. example.com/foo:1234) is passed to parse_url(), a port number is returned. This wasn't the case in, at least, PHP 5.6.6 (3v4l.org seems to crash on this code...). I'm guessing this commit introduced this issue: https://github.com/php/php-src/commit/e49922d3f8060e47f810a24ce48d4e622b493699 Test script: --------------- var_dump(parse_url('//example.com/foo:1234')) Expected result: ---------------- Either bool(false) or array(2) { ["host"]=> string(11) "example.com" ["path"]=> string(9) "/foo:1234" } Actual result: -------------- array(3) { ["host"]=> string(11) "example.com" ["port"]=> int(1234) ["path"]=> string(9) "/foo:1234" } -- Edit bug report at https://bugs.php.net/bug.php?id=70942&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70942&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70942&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70942&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70942&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70942&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70942&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70942&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70942&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70942&r=support Expected behavior: https://bugs.php.net/fix.php?id=70942&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70942&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70942&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70942&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70942&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70942&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70942&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70942&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70942&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70942&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70942&r=mysqlcfg

« previous php.bugs (#197334) next »