Bug #53150 [Opn->Csd]: 127.0.0.1 is valid with FILTER_FLAG_NO_PRIV_RANGE/FILTER_FLAG_NO_RES_RANGE

From: Date: Sun, 12 Dec 2010 18:36:30 +0000
Subject: Bug #53150 [Opn->Csd]: 127.0.0.1 is valid with FILTER_FLAG_NO_PRIV_RANGE/FILTER_FLAG_NO_RES_RANGE
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-156928@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53150&edit=1

 ID:                 53150
 Updated by:         iliaa@php.net
 Reported by:        mentalstring+phpnet at gmail dot com
 Summary:            127.0.0.1 is valid with
                     FILTER_FLAG_NO_PRIV_RANGE/FILTER_FLAG_NO_RES_RANGE
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Filter related
 Operating System:   linux
 PHP Version:        5.3.3
-Assigned To:        
+Assigned To:        iliaa
 Block user comment: N
 Private report:     N

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------
[2010-12-12 19:36:23] iliaa@php.net

Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=306282
Log: Fixed bug #53150 (FILTER_FLAG_NO_RES_RANGE is missing some IP
ranges)

------------------------------------------------------------------------
[2010-10-25 16:07:13] mentalstring+phpnet at gmail dot com

Apologies, entered the wrong output values.

Expected result:

string(9) "127.0.0.1"
string(3) "::1"
bool(false)
bool(false)
bool(false)
bool(false)




Actual result:

string(9) "127.0.0.1"
string(3) "::1"
string(9) "127.0.0.1"
string(3) "::1"
string(9) "127.0.0.1"
string(3) "::1"


The IP address 127.0.0.1 might be a special IP - not quite sure if it
fits in 
the private range, or the reserved range. Or perhaps, there should be a
special 
range for this special cases.

------------------------------------------------------------------------
[2010-10-25 16:01:14] mentalstring+phpnet at gmail dot com

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 this bug report at http://bugs.php.net/bug.php?id=53150&edit=1


Thread (3 messages)

« previous php.bugs (#156928) next »