Bug #77763 [NEW]: parse_url doesn't retrieve the right scheme when url has another ":" after "@"

From: Date: Mon, 18 Mar 2019 14:03:06 +0000
Subject: Bug #77763 [NEW]: parse_url doesn't retrieve the right scheme when url has another ":" after "@"
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220044@lists.php.net to get a copy of this message
From: juanparati at gmail dot com Operating system: MacOs 10.14.3 (Darwin 18.2.0) PHP version: 7.2.16 Package: *URL Functions Bug Type: Bug Bug description:parse_url doesn't retrieve the right scheme when url has another ":" after "@" Description: ------------ I found that "parse_url" function doesn't retrieve the scheme when more than one semicolon is used and url doesn't contain the hostname separator. Test script: --------------- // It works correctly with this case echo parse_url('http://user:pass@example.net', PHP_URL_SCHEME) === 'http' ? 'http' : 'no scheme'; // It doesn't work correctly for the following case echo parse_url('git://git@example.net:myorg/my-repo.git', PHP_URL_SCHEME) === 'http' ? 'GIT' : 'no scheme'; Expected result: ---------------- The expected result is to resolve the scheme as "git" for git urls like: "git://git@example.net:myorg/my-repo.git" Actual result: -------------- "false" is receive -- Edit bug report at https://bugs.php.net/bug.php?id=77763&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77763&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77763&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77763&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77763&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77763&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77763&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77763&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77763&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77763&r=support Expected behavior: https://bugs.php.net/fix.php?id=77763&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77763&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77763&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77763&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77763&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77763&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77763&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77763&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77763&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77763&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77763&r=mysqlcfg

« previous php.bugs (#220044) next »