-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: add valid_url_strict rule #5268
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for implementing this! An old one. I made a code consolidation suggestion.
c671e6f
to
019ea5a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh... apparently I was the one who suggested this type of solution, but I'm not sure I thought it through properly.
I have concerns about the mailto,tel,sms
options. I don't think they will be really helpful to most people and will give users the misconception that we are validating email or phone number here. I know this can be helpful in some cases, but in my opinion only in conjunction with other validation rules.
I would only use https
as the default validScheme
. I don't even know if browsers accept anything with http
without making a big deal out of it these days.
We should indicate that the validation process follows RFC2396
.
Overall, I'm just a little worried that if we leave it the way it is, users will start complaining that it doesn't work the way it should "again"... Am I overthinking this?
How about these?
|
Yes, I agree that we should get rid of I was thinking about it a little more and maybe we should go a step further and assume that the majority of users would like to validate a "normal" URL address - with a valid TLD name in it? I believe that would be the most common use case (we have a separate rule for validating IP addresses). We could validate TLD based on a list e.g: https://github.com/umpirsky/tld-list. It would be an additional step in url validation. Thoughts? |
It seems there are few use cases.
I also think the majority of users would like to validate web addresses. But if users really need to check the URL, they need to check not only TLD, but also domain name. If we check the hostname in a URL, there are a lot of tasks to do. And even if we use laminas-validator, we can't check if the URL really exists. |
I think sticking with validating the "format" is the way to go. I'm not opposed to something larger, like verifying domains and whatnot, but I don't think that belongs in the Format Rules but perhaps an extension of URI class or a separate Validation rule in its own library. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with this current version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay.
Thanks, guys! |
Description
Supersedes #4658
Fixes #3156
The current
valid_url
is too loose.I referred to #4658 (comment)
Checklist: