Bug #74599 [NEW]: parse_url allows bad characters in the common name

From: Date: Mon, 15 May 2017 18:52:01 +0000
Subject: Bug #74599 [NEW]: parse_url allows bad characters in the common name
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209139@lists.php.net to get a copy of this message
From: bj dot cardon at gmail dot com Operating system: Linux PHP version: 7.0.19 Package: URL related Bug Type: Bug Bug description:parse_url allows bad characters in the common name Description: ------------ As the title says, the parse_url function allows backslashes to be in the hostname part of a URL and considers it valid. You can see the test script below showing this behavior. Test script: --------------- bcardon@bcardon-base:~$ php -a Interactive mode enabled php > $u = parse_url("https://www.example.com\\.google.com"); php > print_r($u); Array ( [scheme] => https [host] => www.example.com\.google.com ) Expected result: ---------------- The expected behavior is that invalid characters (including backslashes) will cause parse_url to return FALSE as with any invalid URL. -- Edit bug report at https://bugs.php.net/bug.php?id=74599&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74599&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74599&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74599&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74599&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74599&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74599&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74599&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74599&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74599&r=support Expected behavior: https://bugs.php.net/fix.php?id=74599&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74599&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74599&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74599&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74599&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74599&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74599&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74599&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74599&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74599&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74599&r=mysqlcfg

« previous php.bugs (#209139) next »