[doc-en] master: Fix Uri\WhatWg\Url screens that ignore URL normalization (#5721)

From: Date: Fri, 07 Aug 2026 09:06:48 +0000
Subject: [doc-en] master: Fix Uri\WhatWg\Url screens that ignore URL normalization (#5721)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23543@lists.php.net to get a copy of this message
Author: KentarouTakeda (KentarouTakeda) Committer: GitHub (web-flow) Pusher: jordikroon Date: 2026-08-07T11:06:45+02:00 Commit: https://github.com/php/doc-en/commit/0e06411471a898974e114bd57f624781fe3a0b89 Raw diff: https://github.com/php/doc-en/commit/0e06411471a898974e114bd57f624781fe3a0b89.diff Fix Uri\WhatWg\Url screens that ignore URL normalization (#5721) A WHATWG URL does not store the port when it is the scheme's default, so getPort() and withPort() both echoed null while their screens claimed 443, and Url::parse() normalizes an empty path to "/", which its screen did not show. The extension is new in PHP 8.5, so these were wrong from the start. Echoing null renders as an empty box, so the two port examples use var_dump() now and also show a port that is kept: the contrast is what makes the normalization legible. Changed paths: M reference/uri/uri/whatwg/url/getport.xml M reference/uri/uri/whatwg/url/parse.xml M reference/uri/uri/whatwg/url/withport.xml Diff: diff --git a/reference/uri/uri/whatwg/url/getport.xml b/reference/uri/uri/whatwg/url/getport.xml index 10587042db8e..c123438c6158 100644 --- a/reference/uri/uri/whatwg/url/getport.xml +++ b/reference/uri/uri/whatwg/url/getport.xml @@ -35,16 +35,20 @@ <programlisting role="php"> <![CDATA[ <?php -$url = new \Uri\WhatWg\Url("https://example.com:443"); +$url = new \Uri\WhatWg\Url("https://example.com:8080"); +var_dump($url->getPort()); -echo $url->getPort(); +// 443 is the default port for https, so it is not stored. +$url = new \Uri\WhatWg\Url("https://example.com:443"); +var_dump($url->getPort()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ -443 +int(8080) +NULL ]]> </screen> </example> diff --git a/reference/uri/uri/whatwg/url/parse.xml b/reference/uri/uri/whatwg/url/parse.xml index 560af29fd6e0..a14cb5ebf7a8 100644 --- a/reference/uri/uri/whatwg/url/parse.xml +++ b/reference/uri/uri/whatwg/url/parse.xml @@ -79,7 +79,7 @@ if ($url !== null) { &example.outputs; <screen> <![CDATA[ -Valid URL: https://example.com +Valid URL: https://example.com/ ]]> </screen> </example> diff --git a/reference/uri/uri/whatwg/url/withport.xml b/reference/uri/uri/whatwg/url/withport.xml index 400eabac1e06..ec298021a044 100644 --- a/reference/uri/uri/whatwg/url/withport.xml +++ b/reference/uri/uri/whatwg/url/withport.xml @@ -50,16 +50,21 @@ <![CDATA[ <?php $url = new \Uri\WhatWg\Url("https://example.com:8080"); + +// 443 is the default port for https, so it is not stored. $url = $url->withPort(443); +var_dump($url->getPort()); -echo $url->getPort(); +$url = $url->withPort(8443); +var_dump($url->getPort()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ -443 +NULL +int(8443) ]]> </screen> </example>

« previous php.doc.cvs (#23543) next »