symfony/symfony — pull request #12514 by boekkooi (2014-11-19 09:40:41+00:00)
Title: [Validator] Do URL validation according to RFC's

| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | no
| Fixed tickets | #10467
| License | MIT
| Doc PR | -

**This PR is still very rough but I just want to throw it out there so people can comment etc.**

This PR makes the URL validator RFC aware and more configurable (question should it be more configurable?).

The idea is that we take RFC3986 as a base for the validator and let people configure it according to there needs.
I was mainly thinking of not allowing ip addresses or using custom host name constraints based on different RFC's.

One of the main problems with the new implementation is that none of the RFC's (as far as i can see) allow UTF-8 characters in the host name and this gives some trouble with this current tests.

P.S. the RFC3986 regex can be found at https://gist.github.com/boekkooi/d24fcee6f7082e802ce1/revisions (this is not a full regex since i didn't implement `hier-part` fully)