]> granicus.if.org Git - php/commitdiff
- add IPv6 basic support
authorPierre Joye <pajoye@php.net>
Sat, 13 May 2006 02:43:44 +0000 (02:43 +0000)
committerPierre Joye <pajoye@php.net>
Sat, 13 May 2006 02:43:44 +0000 (02:43 +0000)
  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 ...

ext/filter/filter.c
ext/filter/tests/030.phpt [new file with mode: 0644]

index de31e24d3eabaaa0e95de8610c5b2c1006e98256..6e43727f1ab8977b5f8ddfc6ea62b9f7bf5175d8 100644 (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      },
diff --git a/ext/filter/tests/030.phpt b/ext/filter/tests/030.phpt
new file mode 100644 (file)
index 0000000..af5eb57
--- /dev/null
@@ -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