In his latest post Kevin Dunglas has released information about a patch for URL filtering that aims to bring more validation and functionality to the pre-existing filter_var functionality.
Until now, there was no PHP's filter validating that a given a string is a valid domain name (or hostname). Worst, FILTER_VALIDATE_URL was not fully enforcing domain name validity (this is mandatory for schemes such as http and https) and was allowing invalid URLs. FILTER_VALIDATE_URL was also lacking IPv6 host support.
His patch introduces support for domain validation rules more strict to what the RFC defines and includes IPv6 support. There's a few code examples included in the post showing the new support. He points out that there's still some things that aren't supported yet, like internationalized domains, but there's future plans for it.
Link: http://dunglas.fr/2014/11/php-7-introducing-a-domain-name-validator-and-making-the-url-validator-stricter/
没有评论:
发表评论