Edit report at http://bugs.php.net/bug.php?id=53150&edit=1
ID: 53150 User updated by: mentalstring+phpnet at gmail dot com 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 Type: Bug Package: Filter related Operating System: linux PHP Version: 5.3.3 Block user comment: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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