Skip to content

Instantly share code, notes, and snippets.

@symm symm/gist:3260113
Created Aug 4, 2012

Embed
What would you like to do?
PHP url validation bug
<?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
You can’t perform that action at this time.