Skip to content
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

isUrl validator returns false on "https://example.com?query", but true on "https://example.com/?query" #190

Closed
thorewi opened this issue Apr 27, 2019 · 7 comments

Comments

@thorewi
Copy link

@thorewi thorewi commented Apr 27, 2019

Hi,

I think in both cases it should return "true".

@JanTvrdik
Copy link
Contributor

@JanTvrdik JanTvrdik commented Apr 27, 2019

I think in both cases it should return "true".

Based on what evidence / standard?

@thorewi
Copy link
Author

@thorewi thorewi commented Apr 27, 2019

I think there is no RFC or other standard for what URL is and you can find many opinions across the internet but browser and curl supports "url" with missing slash and I think it's quite widely used.

@JanTvrdik
Copy link
Contributor

@JanTvrdik JanTvrdik commented Apr 28, 2019

I think there is no RFC or other standard for what URL is

There are actually multiple standards.

@thorewi
Copy link
Author

@thorewi thorewi commented Apr 28, 2019

I know there is one for URI (http://www.faqs.org/rfcs/rfc2396.html) where URL is mentioned but not precisely specified... anyway, I think if someone writes https://example.com?query he always means https://example.com/?query so it should be valid... even filter_var('http://example.com?query', FILTER_VALIDATE_URL); succeeds

@JanTvrdik
Copy link
Contributor

@JanTvrdik JanTvrdik commented Apr 28, 2019

😞

RFC 2396 has been obsoleted by RFC 3986 which specifically allows for "path component to be empty".

There is also a living URL standard by WHATWG which also allows for empty path.

@thorewi
Copy link
Author

@thorewi thorewi commented Apr 28, 2019

so should I create PR?

@JanTvrdik
Copy link
Contributor

@JanTvrdik JanTvrdik commented Apr 29, 2019

Yes, that would be awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants