From: Pierre Joye Date: Sat, 13 May 2006 02:43:44 +0000 (+0000) Subject: - add IPv6 basic support X-Git-Tag: BEFORE_NEW_OUTPUT_API~217 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73ed3ce99f7382fb641d6daa49c5efe91855ce63;p=php - add IPv6 basic support unicast, multicast or other local loop will come after 0.10.0 test 014 fails: "Notice: Object of class stdClass to string conversion" is now "Catchable fatal error: Object of class stdClass could not be converted to IS_STRING", to verify ... --- diff --git a/ext/filter/filter.c b/ext/filter/filter.c index de31e24d3e..6e43727f1a 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -51,7 +51,7 @@ filter_list_entry filter_list[] = { { "stripped", FILTER_SANITIZE_STRING, php_filter_string }, { "encoded", FILTER_SANITIZE_ENCODED, php_filter_encoded }, { "special_chars", FILTER_SANITIZE_SPECIAL_CHARS, php_filter_special_chars }, - { "unsafe_raw", FILTER_UNSAFE_RAW, php_filter_unsafe_raw }, + { "unsafe_raw", FILTER_UNSAFE_RAW, php_filter_unsafe_raw }, { "email", FILTER_SANITIZE_EMAIL, php_filter_email }, { "url", FILTER_SANITIZE_URL, php_filter_url }, { "number_int", FILTER_SANITIZE_NUMBER_INT, php_filter_number_int }, diff --git a/ext/filter/tests/030.phpt b/ext/filter/tests/030.phpt new file mode 100644 index 0000000000..af5eb57465 --- /dev/null +++ b/ext/filter/tests/030.phpt @@ -0,0 +1,35 @@ +--TEST-- +filter_data() and FILTER_CALLBACK +--FILE-- + true, + "FF01::101:127.0.1" => false, + "FF01:0:0:0:101:127.0.1.1" => false, + "FF01:0:0:0:237:101:127.0.1.1" => true, + "FF01::101" => true, + "A1080::8:800:200C:417A" => false, + "1080::8:Z00:200C:417A" => false, + "FF01::101::1" => false, + "1080::8:800:200C:417A" => true, + "1080:0:0:0:8:800:200C:417A" => true, + "2001:ec8:1:1:1:1:1:1" => true, + "ffff::FFFF:129.144.52.38" => true, + "::ffff:1.2.3.4" => true, + "0:0:0:0:0:FFFF:129.144.52.38" => true, + "0:0:0:0:0:0:13.1.68.3" => true, + "::13.1.68.3" => true, + "::FFFF:129.144.52.38" => true +); +foreach ($ipv6_test as $ip => $exp) { + $out = filter_data($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6); + $out = (int) (is_null($out) ? 0 : 1); + if ($exp != $out) { + echo "$ip failed\n"; + } +} + +echo "Ok\n"; +?> +--EXPECT-- +Ok