From 6f423adbb2591bfe47ef9c83f538ad1c69968985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Mon, 27 Jul 2026 11:07:13 +0900 Subject: [PATCH] Fix Uri\WhatWg\Url screens that ignore URL normalization 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. --- reference/uri/uri/whatwg/url/getport.xml | 10 +++++++--- reference/uri/uri/whatwg/url/parse.xml | 2 +- reference/uri/uri/whatwg/url/withport.xml | 9 +++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) 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 @@ 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()); ?> ]]> &example.outputs; 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; 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 @@ withPort(443); +var_dump($url->getPort()); -echo $url->getPort(); +$url = $url->withPort(8443); +var_dump($url->getPort()); ?> ]]> &example.outputs;