Uri Fix classname and extra e.g., amend examples, describe normalization - #5548
Open
mmalferov wants to merge 44 commits into
Open
Uri Fix classname and extra e.g., amend examples, describe normalization#5548mmalferov wants to merge 44 commits into
Uri Fix classname and extra e.g., amend examples, describe normalization#5548mmalferov wants to merge 44 commits into
Conversation
e.g.Uri\WhatWg\Url::construct Fix classname and extra e.g.
Uri\WhatWg\Url::construct Fix classname and extra e.g.Uri\WhatWg\Url::construct Fix classname and extra e.g., amend example
Uri\WhatWg\Url::construct Fix classname and extra e.g., amend exampleUri\WhatWg\Url::construct Fix classname and extra e.g., amend examples
lacatoire
approved these changes
May 12, 2026
Uri\WhatWg\Url::construct Fix classname and extra e.g., amend examplesUri Fix classname and extra e.g., amend examples
Uri Fix classname and extra e.g., amend examplesUri Fix classname and extra e.g., amend examples, describe normalization
Member
|
FYI: This will conflict with #5471. |
And is the return type `?static` accurate and not `?self` or literally `?Uri\WhatWg\Url`, and doesn't it confuse the reader, since the class is final?
```PHP_METHOD(Uri_Rfc3986_Uri, getPort)
{
php_uri_property_read_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_URI_PROPERTY_NAME_PORT, PHP_URI_COMPONENT_READ_MODE_RAW);
}```
Judging by the source code, the `port` component, unlike the `password` or the `host` components, is not normalized. It seems that the mention of normalization was included in the description by mistake :)
```PHP_METHOD(Uri_Rfc3986_Uri, getPassword)
{
php_uri_property_read_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_URI_PROPERTY_NAME_PASSWORD, PHP_URI_COMPONENT_READ_MODE_NORMALIZED_ASCII);
}```
...an non-normalized in the return section for consistency with other methods
The example rewrites in the RFC 3986 getter pages overlap with php#5471, which unifies the example URL across all of them; reverting them here leaves the two pull requests disjoint. The normalization entities and the wording changes stay. Also corrects four points in what is left: - the normalization entity omitted dot segment removal, which is what getPath() visibly does - the non-normalization entity claimed components are returned in their original form, which toRawString() and a resolved getRawPath() both contradict - getPort() does normalize, it drops leading zeros, so the page keeps its wording - Ipv4InIpv6InvalidCodePoint is also raised for an empty part, a leading zero and too many parts, not only for an invalid code point
The non-normalization entity said "No normalization is applied", which toRawString() contradicts for an IPv6 host: the host is recomposed from its parsed form, so [2001:DB8::1] comes back fully expanded and in lowercase even when the input was already compressed. Drop the absolute claim, keep the four clauses that do hold, add the dot segment mirror of the other entity, and state the IPv6 exception on the toRawString() page itself. Uri\WhatWg\Url::__construct() and ::parse() gave /foo as an example of "a valid URL string", but both reject it without a baseUrl (MissingSchemeNonRelativeUrl). Say so instead. Uri\WhatWg\Url::resolve() does accept it, and only needed the duplicated "(e.g." removed, which is the third occurrence of the one this pull request already fixed.
The three pages need a non-ASCII host, since getAsciiHost(), toAsciiString() and toUnicodeString() only differ from getHost() and toString() on an internationalized domain name; with a plain example.com they printed back their own input. The label itself does not have to be an eighteen letter compound though: the manual already uses "täst" for this on the intl idn pages, which keeps the punycode short enough to read in a screen block.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.