Created
August 4, 2012 21:39
-
-
Save symm/3260113 to your computer and use it in GitHub Desktop.
PHP url validation bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* FILTER_VALIDATE_URL Validates value as URL (according to » http://www.faqs.org/rfcs/rfc2396) | |
* http://php.net/manual/en/filter.filters.validate.php | |
*/ | |
$check = filter_var('http://google.com/', FILTER_VALIDATE_URL); | |
var_dump($check); | |
// $check = string(18) "http://google.com/" | |
// Trailing dot in domain (valid) is incorrectly rejected | |
$check = filter_var('http://google.com./', FILTER_VALIDATE_URL); | |
var_dump($check); | |
// $check = bool(false) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment