diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-03-18 11:28:21 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-03-18 11:28:21 +0100 |
commit | 038ba12e8724d537040e88ec794354b0c063f0a6 (patch) | |
tree | a7181b4f4d10e3a154522d4b96fdf42f4597bf2a /ext/filter/tests | |
parent | fd5a0b31640419ca63d1ddeaffd6d3cf2a741814 (diff) | |
download | php-038ba12e8724d537040e88ec794354b0c063f0a6.tar.gz |
Imported Upstream version 5.3.6upstream/5.3.6
Diffstat (limited to 'ext/filter/tests')
-rw-r--r-- | ext/filter/tests/015.phpt | 10 | ||||
-rw-r--r-- | ext/filter/tests/018.phpt | 4 | ||||
-rw-r--r-- | ext/filter/tests/bug47435.phpt | 34 | ||||
-rw-r--r-- | ext/filter/tests/bug52209.phpt | 10 | ||||
-rw-r--r-- | ext/filter/tests/bug53150.phpt | 28 |
5 files changed, 84 insertions, 2 deletions
diff --git a/ext/filter/tests/015.phpt b/ext/filter/tests/015.phpt index a9c4a8cf4..476615ae3 100644 --- a/ext/filter/tests/015.phpt +++ b/ext/filter/tests/015.phpt @@ -28,6 +28,10 @@ array(), 'news:news.php.net', 'file://foo/bar', "http://\r\n/bar", +"http://example.com:qq", +"http://example.com:-2", +"http://example.com:65536", +"http://example.com:65537", ); foreach ($values as $value) { var_dump(filter_var($value, FILTER_VALIDATE_URL)); @@ -70,6 +74,10 @@ string(17) "news:news.php.net" string(14) "file://foo/bar" bool(false) bool(false) +bool(false) +bool(false) +bool(false) +bool(false) string(10) "http://qwe" bool(false) bool(false) @@ -78,4 +86,4 @@ bool(false) string(42) "http://www.example.com/path/at/the/server/" bool(false) string(40) "http://www.example.com/index.php?a=b&c=d" -Done
\ No newline at end of file +Done diff --git a/ext/filter/tests/018.phpt b/ext/filter/tests/018.phpt index 10840aae7..af52b2e60 100644 --- a/ext/filter/tests/018.phpt +++ b/ext/filter/tests/018.phpt @@ -24,6 +24,7 @@ var_dump(filter_var(-1, FILTER_VALIDATE_IP)); var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)); var_dump(filter_var("127.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); +var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); var_dump(filter_var("127.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)); echo "Done\n"; ?> @@ -37,7 +38,7 @@ bool(false) string(9) "127.0.0.1" bool(false) string(12) "192.0.34.166" -string(9) "127.0.0.1" +bool(false) string(9) "192.0.0.1" string(12) "192.0.34.166" bool(false) @@ -48,5 +49,6 @@ bool(false) bool(false) bool(false) string(3) "::1" +bool(false) string(9) "127.0.0.1" Done diff --git a/ext/filter/tests/bug47435.phpt b/ext/filter/tests/bug47435.phpt new file mode 100644 index 000000000..42705fdc6 --- /dev/null +++ b/ext/filter/tests/bug47435.phpt @@ -0,0 +1,34 @@ +--TEST--
+Bug #47435 (FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE don't work with ipv6)
+--FILE--
+<?php
+var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
+var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE));
+var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
+var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
+var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
+var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
+var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
+var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
+var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
+?>
+--EXPECT--
+string(7) "FC00::1"
+bool(false)
+string(2) "::"
+bool(false)
+string(3) "::1"
+bool(false)
+string(10) "fe8:5:6::1"
+bool(false)
+string(12) "2001:0db8::1"
+bool(false)
+string(5) "5f::1"
+bool(false)
+string(7) "3ff3::1"
+bool(false)
diff --git a/ext/filter/tests/bug52209.phpt b/ext/filter/tests/bug52209.phpt new file mode 100644 index 000000000..49408ea12 --- /dev/null +++ b/ext/filter/tests/bug52209.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #52209 (INPUT_ENV returns NULL for set variables (CLI)) +--SKIPIF-- +<?php if (!extension_loaded("filter") || !empty($_ENV['PWD'])) die("skip"); ?> +--FILE-- +<?php + var_dump(filter_input(INPUT_ENV, 'PWD')); +?> +--EXPECTF-- +string(%d) "%s" diff --git a/ext/filter/tests/bug53150.phpt b/ext/filter/tests/bug53150.phpt new file mode 100644 index 000000000..4baa4db77 --- /dev/null +++ b/ext/filter/tests/bug53150.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #53150 (FILTER_FLAG_NO_RES_RANGE is missing some IP ranges) +--SKIPIF-- +<?php if (!extension_loaded("filter")) die("skip"); ?> +--FILE-- +<?php +var_dump(filter_var('127.0.0.1', FILTER_VALIDATE_IP)); +var_dump(filter_var("::1", FILTER_VALIDATE_IP)); + +var_dump(filter_var('127.0.0.1', FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)); +var_dump(filter_var('::1', FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)); + +var_dump(filter_var('128.0.0.1', FILTER_VALIDATE_IP)); +var_dump(filter_var('128.0.0.1', FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)); + +var_dump(filter_var('191.255.0.0', FILTER_VALIDATE_IP)); +var_dump(filter_var('191.255.0.0', FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)); + +?> +--EXPECT-- +string(9) "127.0.0.1" +string(3) "::1" +bool(false) +bool(false) +string(9) "128.0.0.1" +bool(false) +string(11) "191.255.0.0" +bool(false) |