In reply to:
Improve parse_url usage
In some edge cases, I’ve gotten a TypeError in parseUriToComponents()
, when called by the function resolveUrl()
(not the class method of the same name). This happens because parse_url can return false and it’s not checking for that before calling array_key_exists:
array_key_exists(): Argument #2 ($array) must be of type array, bool given
A real-world example is @pmoralesgarcia has domain-relative links like href="/blog/tag:2024/"
which parse_url has trouble with, probably because of the colon. I haven’t researched the best solution, but something like the class method might be enough. It might be worth seeing what sabre-io/uri does. I’ve been using that in some other code and liking it so far.