You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
In some edge cases, I’ve gotten a TypeError in
parseUriToComponents()
, when called by the functionresolveUrl()
(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: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.(Originally published at: https://gregorlove.com/2024/03/improve-parse-url-usage/)
The text was updated successfully, but these errors were encountered: