Re: [RFC] [Discussion] Add WHATWG compliant URL parsing API
| From: | Tim Düsterhus | Date: | Mon, 24 Feb 2025 09:43:45 +0000 |
| Subject: | Re: [RFC] [Discussion] Add WHATWG compliant URL parsing API | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126488@lists.php.net to get a copy of this message | ||
Hi
Am 2025-02-24 10:18, schrieb Ignace Nyamagana Butera:
5 - Can the returned array from __debugInfo be used in a "normal" method like toComponents naming can be changed/improve to ease migration from parse_url or is this left for userland library ?
I would prefer not expose this functionality for the same reason that there are no raw properties provided: The user must make an explicit choice whether they are interested in the raw or in the normalized version of the individual components.
It can make sense to normalize a hostname, but not the path. My usual example against normalizing the path is that SAML signs the *encoded* URI instead of the payload and changing the case in percent-encoded characters is sufficient to break the signature, e.g. %2f is different than %2F from a SAML signature perspective, requiring workarounds like this: https://github.com/SAML-Toolkits/php-saml/blob/c89d78c4aa398767cf9775d9e32d445e64213425/lib/Saml2/Utils.php#L724-L737
Best regards
Tim Düsterhus