|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-10-21 06:38 UTC] smiley at chillerlan dot net
Description: ------------ In the current PHP 8 nightly Linux builds, parse_url() drops silently an invalid port number 0 and returns an array with the host part of an otherwise invalid URI. PHP 7 on Linux & Windows, as well as PHP 8 on Windows will return false instead, which is expected. https://github.com/chillerlan/php-httpinterface/runs/1284984428#step:10:21 https://travis-ci.org/github/chillerlan/php-httpinterface/jobs/737623526#L288 Test script: --------------- $parsed = parse_url('//portcannotbezero.com:0'); var_dump($parsed); https://github.com/chillerlan/php-httpinterface/commit/cefbdb1163d508f52f199abd4b958319b48012ba Source: https://github.com/chillerlan/php-httpinterface/blob/46b563fd9ab2b92c1cf4efa3c429d6872de2eab4/src/Psr7/Uri.php#L65-L69 https://github.com/chillerlan/php-httpinterface/blob/46b563fd9ab2b92c1cf4efa3c429d6872de2eab4/tests/Psr7/UriTest.php#L144-L149 (similar to guzzle/psr7) Expected result: ---------------- parse_url('//portcannotbezero.com:0') should return the same result "false" across all platforms. https://github.com/chillerlan/php-httpinterface/runs/1284984456 https://travis-ci.org/github/chillerlan/php-httpinterface/jobs/737623525#L287 Actual result: -------------- array(1) { 'host' => string(20) "portcannotbezero.com" } PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
$ x64\Debug\php -v PHP 8.0.0-dev (cli) (built: Oct 16 2020 18:46:05) ( NTS Visual C++ 2019 x64 DEBUG ) Copyright (c) The PHP Group Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies C:\php-sdk\phpdev\vs16\x64\php-src-8.0 $ x64\Debug\php -r "var_dump(parse_url('//portcannotbezero.com:0'));" array(1) { ["host"]=> string(20) "portcannotbezero.com" } IOW, I cannot reproduce.