-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FILTER_VALIDATE_URL returns false when underscore present in URL #17842
Comments
If we look at your uri, it's an absolute URI:
And it wants to follow hier_part:
We have a double slash, so it's a net_path:
It seems that the filter extension only checks the |
Blame |
@nielsdos Thanks for reading further into the specification than I initially did. Section 3.2.1 specifies the "Registry-based Naming Authority" with the
Where the server part of authority is specified as
And hostport is
Which means that strictly following the RFC, domains cannot contain underscores (they work in DNS and on the internet, but not as specified in this RFC). So the PHP filter seems to be correct for filtering valid URLs, strictly following the RFC. |
To clarify: |
Description
The following code:
Resulted in this output:
But I expected this output instead:
The underscore is a valid character according to the RFC 2396 section 2.3:
But this filter fails if a underscore is present in the domain or subdomain portion of the URL.
This RFC is superseded by RFC 3986, but the underscore is still in the unreserved characters:
PHP Version
PHP 8.4.4
Operating System
No response
The text was updated successfully, but these errors were encountered: