[wp-trac] [WordPress Trac] #40353: Site URL and Home URL inputs are not properly validating
WordPress Trac
noreply at wordpress.org
Mon May 1 21:34:07 UTC 2017
#40353: Site URL and Home URL inputs are not properly validating
----------------------------------------+------------------------------
Reporter: subrataemfluence | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version:
Severity: normal | Resolution:
Keywords: good-first-bug needs-patch | Focuses: administration
----------------------------------------+------------------------------
Comment (by loru88):
@shulard as I know ''parse_url'' doesn't validate the url
The idea of a dedicated function is ok, but I upload a patch to validate
the url against a simple regex.
It takes into consideration just http and https, a valid hostname or ip
address, an optional port and an optional path.
a filter is applied to the regex in case someone needs different
validation pattern.
I taked inspiration from Symfony UrlValidator but I simplified the regex:
[https://github.com/symfony/validator/blob/master/Constraints/UrlValidator.php]
Could be useful to add a unit test on this function.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40353#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list