Re: about PHP's filter_var function

From: Date: Thu, 20 Sep 2012 16:17:10 +0000
Subject: Re: about PHP's filter_var function
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-319160@lists.php.net to get a copy of this message
On 20-09-2012 18:03, Jim Lucas wrote:
On 09/20/2012 02:35 AM, Sebastian Krebs wrote:
Plaseplease update... 5.1.6 is from 2006! I read the "it's required", but I can't imagine _anything_ that it's worth it to use such an extremely outdated, unsupported and therefore insecure and inefficient version... You know: There are 3 (!) new minor versions available right now (5.2, 5.3 and 5.4). However: Regarding your concrete problem I guess you can use ip2long() if (ip2long($ip)) {
I would suggest a modification to this. if ( ip2long($ip) !== false ) {
I would actually suggest using inet_pton() instead of ip2long, since it can also handle IPv6 adresses, not only v4 which people here seem to think are the only ones in use on this planet. And I agree with Jim that you really should use a strict equality check in this case. - Tul

« previous php.general (#319160) next »