1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 10:12:18 +01:00

- 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 ...
This commit is contained in:
Pierre Joye
2006-05-13 02:43:44 +00:00
parent 00d423980a
commit 73ed3ce99f
2 changed files with 36 additions and 1 deletions

View File

@@ -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 },

35
ext/filter/tests/030.phpt Normal file
View File

@@ -0,0 +1,35 @@
--TEST--
filter_data() and FILTER_CALLBACK
--FILE--
<?php
$ipv6_test = array(
"::127.0.0.1" => 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