Bug #53150 [NEW]: 127.0.0.1 is valid with FILTER_FLAG_NO_PRIV_RANGE/FILTER_FLAG_NO_RES_RANGE

From: Date: Mon, 25 Oct 2010 14:01:15 +0000
Subject: Bug #53150 [NEW]: 127.0.0.1 is valid with FILTER_FLAG_NO_PRIV_RANGE/FILTER_FLAG_NO_RES_RANGE
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155496@lists.php.net to get a copy of this message
From:             
Operating system: linux
PHP version:      5.3.3
Package:          Filter related
Bug Type:         Bug
Bug description:127.0.0.1 is valid with FILTER_FLAG_NO_PRIV_RANGE/FILTER_FLAG_NO_RES_RANGE

Description:
------------
The 127.0.0.1 IP address is considered to be valid even when filtering with
either 
the FILTER_FLAG_NO_RES_RANGE and FILTER_FLAG_NO_PRIV_RANGE flags.

This might be related with bug #47435.

Test script:
---------------
var_dump(filter_var('127.0.0.1', FILTER_VALIDATE_IP)); // true
var_dump(filter_var("::1", FILTER_VALIDATE_IP)); // true

var_dump(filter_var('127.0.0.1', FILTER_VALIDATE_IP,
FILTER_FLAG_NO_RES_RANGE)); // false
var_dump(filter_var('::1', FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
// false

var_dump(filter_var('127.0.0.1', FILTER_VALIDATE_IP,
FILTER_FLAG_NO_PRIV_RANGE));
var_dump(filter_var('::1', FILTER_VALIDATE_IP,
FILTER_FLAG_NO_PRIV_RANGE));


Expected result:
----------------
true
true
false
false
false
false

Actual result:
--------------
true
true
false
false
false
false

-- 
Edit bug report at http://bugs.php.net/bug.php?id=53150&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=53150&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=53150&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=53150&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=53150&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53150&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=53150&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=53150&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=53150&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=53150&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=53150&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=53150&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=53150&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=53150&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=53150&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53150&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53150&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=53150&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=53150&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=53150&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=53150&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=53150&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#155496) next »