PHP filter_var() - FILTER_VALIDATE_URL

Posted by Alix Axel on Stack Overflow See other posts from Stack Overflow or by Alix Axel
Published on 2010-01-26T01:51:55Z Indexed on 2010/03/31 23:53 UTC
Read the original article Hit count: 407

Filed under:
|
|
|
|

The FILTER_VALIDATE_URL filter seems to have some trouble validating non-ASCII URLs:

var_dump(filter_var('http://pt.wikipedia.org/wiki/', FILTER_VALIDATE_URL)); // http://pt.wikipedia.org/wiki/
var_dump(filter_var('http://pt.wikipedia.org/wiki/GuimarĂ£es', FILTER_VALIDATE_URL)); // false

Why isn't the last URL correctly validated? And what are the possible workarounds? Running PHP 5.3.0.

I'd also like to know where I can find the source code of the FILTER_VALIDATE_URL validation filter.

© Stack Overflow or respective owner

Related posts about php

Related posts about validation