/php-src/ext/filter/tests/ |
H A D | 018.phpt | 2 filter_var() and FILTER_VALIDATE_IP 7 var_dump(filter_var("192.168.0.1", FILTER_VALIDATE_IP)); 8 var_dump(filter_var("192.168.0.1.1", FILTER_VALIDATE_IP)); 9 var_dump(filter_var("::1", FILTER_VALIDATE_IP)); 10 var_dump(filter_var("fe00::0", FILTER_VALIDATE_IP)); 11 var_dump(filter_var("::123456", FILTER_VALIDATE_IP)); 12 var_dump(filter_var("::1::b", FILTER_VALIDATE_IP)); 13 var_dump(filter_var("127.0.0.1", FILTER_VALIDATE_IP)); 20 var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP)); 24 var_dump(filter_var("", FILTER_VALIDATE_IP)); [all …]
|
H A D | filter_data.phpt | 2 Simple filter_var() tests 11 $data = "-123"; var_dump(filter_var($data, FILTER_VALIDATE_INT)); 12 $data = "0"; var_dump(filter_var($data, FILTER_VALIDATE_INT)); 13 $data = "-0"; var_dump(filter_var($data, FILTER_VALIDATE_INT)); 14 $data = "+0"; var_dump(filter_var($data, FILTER_VALIDATE_INT)); 15 $data = "123"; var_dump(filter_var($data, FILTER_VALIDATE_INT)); 16 $data = -123; var_dump(filter_var($data, FILTER_VALIDATE_INT)); 17 $data = 0; var_dump(filter_var($data, FILTER_VALIDATE_INT)); 18 $data = -0; var_dump(filter_var($data, FILTER_VALIDATE_INT)); 20 $data = 123; var_dump(filter_var($data, FILTER_VALIDATE_INT)); [all …]
|
H A D | 013.phpt | 2 filter_var() and flags 7 var_dump(filter_var(" 234", FILTER_VALIDATE_INT)); 8 var_dump(filter_var("234 ", FILTER_VALIDATE_INT)); 9 var_dump(filter_var(" 234 ", FILTER_VALIDATE_INT)); 10 var_dump(filter_var("0xff", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_HEX))); 11 var_dump(filter_var("0Xff", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_HEX))); 12 var_dump(filter_var("0xFF", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_HEX))); 13 var_dump(filter_var("0XFF", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_HEX))); 14 var_dump(filter_var("07", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))); 38 var_dump(filter_var("0ff", FILTER_VALIDATE_INT)); [all …]
|
H A D | 021.phpt | 2 filter_var() and FILTER_SANITIZE_NUMBER_* 8 var_dump(filter_var("qwertyu123456dfghj", FILTER_SANITIZE_NUMBER_INT)); 9 var_dump(filter_var("asd123123.asd123.23", FILTER_SANITIZE_NUMBER_INT)); 10 var_dump(filter_var("123,23", FILTER_SANITIZE_NUMBER_INT)); 11 var_dump(filter_var("", FILTER_SANITIZE_NUMBER_INT)); 12 var_dump(filter_var("0", FILTER_SANITIZE_NUMBER_INT)); 13 var_dump(filter_var("asd123.2asd", FILTER_SANITIZE_NUMBER_INT)); 14 var_dump(filter_var("qwertyuiop", FILTER_SANITIZE_NUMBER_INT)); 15 var_dump(filter_var("123.4", FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); 16 var_dump(filter_var("123,4", FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); [all …]
|
H A D | 014.phpt | 2 filter_var() and FILTER_VALIDATE_BOOLEAN 17 var_dump(filter_var("no", FILTER_VALIDATE_BOOLEAN)); 18 var_dump(filter_var(NULL, FILTER_VALIDATE_BOOLEAN)); 19 var_dump(filter_var($t, FILTER_VALIDATE_BOOLEAN)); 21 var_dump(filter_var("yes", FILTER_VALIDATE_BOOLEAN)); 24 var_dump(filter_var("off", FILTER_VALIDATE_BOOLEAN)); 25 var_dump(filter_var("on", FILTER_VALIDATE_BOOLEAN)); 26 var_dump(filter_var("0", FILTER_VALIDATE_BOOLEAN)); 27 var_dump(filter_var("1", FILTER_VALIDATE_BOOLEAN)); 29 var_dump(filter_var("", FILTER_VALIDATE_BOOLEAN)); [all …]
|
H A D | 061.phpt | 2 filter_var() and FILTER_VALIDATE_BOOL 17 var_dump(filter_var("no", FILTER_VALIDATE_BOOL)); 18 var_dump(filter_var(NULL, FILTER_VALIDATE_BOOL)); 19 var_dump(filter_var($t, FILTER_VALIDATE_BOOL)); 21 var_dump(filter_var("yes", FILTER_VALIDATE_BOOL)); 24 var_dump(filter_var("off", FILTER_VALIDATE_BOOL)); 25 var_dump(filter_var("on", FILTER_VALIDATE_BOOL)); 26 var_dump(filter_var("0", FILTER_VALIDATE_BOOL)); 27 var_dump(filter_var("1", FILTER_VALIDATE_BOOL)); 29 var_dump(filter_var("", FILTER_VALIDATE_BOOL)); [all …]
|
H A D | bug47435.phpt | 7 var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); 9 var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); 10 var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); 11 var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); 12 var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); 13 var_dump(filter_var("fe80:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); 15 var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); 17 var_dump(filter_var("2001:0010::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); 19 var_dump(filter_var("240b:0010::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); 21 var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); [all …]
|
H A D | 028.phpt | 2 filter_var() and FILTER_SANITIZE_SPECIAL_CHARS 8 var_dump(filter_var("?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn", FILTER_SANITIZE_SPECIAL_CHARS)); 9 var_dump(filter_var("<data&sons>", FILTER_SANITIZE_SPECIAL_CHARS)); 10 var_dump(filter_var("", FILTER_SANITIZE_SPECIAL_CHARS)); 12 var_dump(filter_var("?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn", FILTER_SANITIZE_SPECIAL_CHARS, F… 13 var_dump(filter_var("<data&sons>", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_LOW)); 14 var_dump(filter_var("", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_LOW)); 17 var_dump(filter_var("<data&sons>", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_HIGH)); 18 var_dump(filter_var("", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_HIGH)); 20 var_dump(filter_var("кириллица", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_HIGH)); [all …]
|
H A D | bug49510.phpt | 7 var_dump(filter_var(false, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); 8 var_dump(filter_var(0, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); 9 var_dump(filter_var("0", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); 10 var_dump(filter_var("off", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); 11 var_dump(filter_var("", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); 12 var_dump(filter_var("false", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); 13 var_dump(filter_var("no", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); 15 var_dump(filter_var(true, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); 16 var_dump(filter_var(1, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); 17 var_dump(filter_var("1", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); [all …]
|
H A D | surprising_integer_literals.phpt | 8 var_dump(filter_var('0x', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX)); 9 var_dump(filter_var('0xg', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX)); 10 var_dump(filter_var('0X', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX)); 11 var_dump(filter_var('0Xg', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX)); 12 var_dump(filter_var('', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX)); 14 var_dump(filter_var('0o', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_OCTAL)); 15 var_dump(filter_var('0og', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_OCTAL)); 16 var_dump(filter_var('0O', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_OCTAL)); 18 var_dump(filter_var('O', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_OCTAL)); 19 var_dump(filter_var('Og', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_OCTAL)); [all …]
|
H A D | filter_null_on_failure.phpt | 7 var_dump(filter_var("invalid", FILTER_VALIDATE_BOOL, FILTER_NULL_ON_FAILURE)); 8 var_dump(filter_var("invalid", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)); 9 var_dump(filter_var("invalid", FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE)); 10 var_dump(filter_var("invalid", FILTER_VALIDATE_FLOAT, FILTER_NULL_ON_FAILURE)); 11 var_dump(filter_var(".invalid", FILTER_VALIDATE_DOMAIN, FILTER_NULL_ON_FAILURE)); 12 var_dump(filter_var("invalid", FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE)); 13 var_dump(filter_var("invalid", FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE)); 14 var_dump(filter_var("invalid", FILTER_VALIDATE_MAC, FILTER_NULL_ON_FAILURE)); 15 var_dump(filter_var("invalid", FILTER_VALIDATE_REGEXP, [ 21 var_dump(filter_var("invalid", FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE));
|
H A D | bug53150.phpt | 7 var_dump(filter_var('127.0.0.1', FILTER_VALIDATE_IP)); 8 var_dump(filter_var("::1", FILTER_VALIDATE_IP)); 10 var_dump(filter_var('127.0.0.1', FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)); 11 var_dump(filter_var('::1', FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)); 13 var_dump(filter_var('128.0.0.1', FILTER_VALIDATE_IP)); 14 var_dump(filter_var('128.0.0.1', FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)); 16 var_dump(filter_var('191.255.0.0', FILTER_VALIDATE_IP)); 17 var_dump(filter_var('191.255.0.0', FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
|
H A D | 029.phpt | 2 filter_var() and FILTER_CALLBACK 13 var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test"))); 15 var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test"))); 18 filter_var("qwe", FILTER_CALLBACK, array("options"=>"no such func")); 24 filter_var("qwe", FILTER_CALLBACK, array("options"=>"")); 30 filter_var("qwe", FILTER_CALLBACK); 52 var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test1"))); 61 var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test2"))); 80 filter_var(): Option must be a valid callback 81 filter_var(): Option must be a valid callback [all …]
|
H A D | 027.phpt | 2 filter_var() and FILTER_SANITIZE_ENCODED 8 var_dump(filter_var("?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn", FILTER_SANITIZE_ENCODED)); 9 var_dump(filter_var("<data&sons>", FILTER_SANITIZE_ENCODED)); 10 var_dump(filter_var("", FILTER_SANITIZE_ENCODED)); 12 var_dump(filter_var("?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn", FILTER_SANITIZE_ENCODED, FILTER_… 13 var_dump(filter_var("<data&sons>", FILTER_SANITIZE_ENCODED, FILTER_FLAG_ENCODE_LOW)); 14 var_dump(filter_var("", FILTER_SANITIZE_ENCODED, FILTER_FLAG_ENCODE_LOW)); 16 var_dump(filter_var("?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn", FILTER_SANITIZE_ENCODED, FILTER_… 17 var_dump(filter_var("<data&sons>", FILTER_SANITIZE_ENCODED, FILTER_FLAG_ENCODE_HIGH)); 18 var_dump(filter_var("", FILTER_SANITIZE_ENCODED, FILTER_FLAG_ENCODE_HIGH));
|
H A D | 010.phpt | 2 filter_var() 10 var_dump(filter_var(array(1,"1","", "-23234", "text", "asdf234asdfgs", array()), FILTER_VALIDATE_IN… 11 var_dump(filter_var(array(1.2,"1.7","", "-23234.123", "text", "asdf234.2asdfgs", array()), FILTER_V… 12 var_dump(filter_var(1, FILTER_SANITIZE_SPECIAL_CHARS, 1)); 13 var_dump(filter_var(1, FILTER_SANITIZE_SPECIAL_CHARS, 0)); 14 var_dump(filter_var(1, FILTER_SANITIZE_SPECIAL_CHARS, array())); 15 var_dump(filter_var(1, -1, array(123))); 16 var_dump(filter_var(1, 0, array())); 59 Warning: filter_var(): Unknown filter with ID -1 in %s on line %d 62 Warning: filter_var(): Unknown filter with ID 0 in %s on line %d
|
H A D | 017.phpt | 2 filter_var() and FILTER_VALIDATE_REGEXP 8 var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/.*/')))); 9 var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/^b(.*)/')))); 10 var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/^d(.*)/')))); 11 var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/blah/')))); 12 var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/\[/')))); 14 filter_var("data", FILTER_VALIDATE_REGEXP); 27 filter_var(): "regexp" option is missing
|
H A D | 019.phpt | 2 filter_var() & FILTER_VALIDATE_IP and weird data 8 var_dump(filter_var("....", FILTER_VALIDATE_IP)); 9 var_dump(filter_var("...", FILTER_VALIDATE_IP)); 10 var_dump(filter_var("..", FILTER_VALIDATE_IP)); 11 var_dump(filter_var(".", FILTER_VALIDATE_IP)); 12 var_dump(filter_var("1.1.1.1", FILTER_VALIDATE_IP));
|
H A D | 022.phpt | 2 filter_var() and FILTER_SANITIZE_EMAIL 8 var_dump(filter_var("a@b.c", FILTER_SANITIZE_EMAIL)); 9 var_dump(filter_var("a[!@#$%^&*()@a@#$%^&*(.com@#$%^&*(", FILTER_SANITIZE_EMAIL)); 10 var_dump(filter_var("white space here \ \ \" some more", FILTER_SANITIZE_EMAIL)); 11 var_dump(filter_var("", FILTER_SANITIZE_EMAIL)); 12 var_dump(filter_var("123456789000000", FILTER_SANITIZE_EMAIL));
|
H A D | 025.phpt | 2 filter_var() and FILTER_SANITIZE_STRING 8 var_dump(filter_var("", FILTER_SANITIZE_STRING)); 9 var_dump(filter_var("<>", FILTER_SANITIZE_STRING)); 10 var_dump(filter_var("<>!@#$%^&*()'\"", FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES)); 11 var_dump(filter_var("<>!@#$%^&*()'\"", FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP)); 12 var_dump(filter_var("<>`1234567890", FILTER_SANITIZE_STRING)); 13 var_dump(filter_var("`123`", FILTER_SANITIZE_STRING)); 14 var_dump(filter_var(".", FILTER_SANITIZE_STRING));
|
H A D | 059.phpt | 2 filter_var() and FILTER_SANITIZE_ADD_SLASHES 8 var_dump(filter_var("test'asd'asd'' asd\'\"asdfasdf", FILTER_SANITIZE_ADD_SLASHES)); 9 var_dump(filter_var("'", FILTER_SANITIZE_ADD_SLASHES)); 10 var_dump(filter_var("", FILTER_SANITIZE_ADD_SLASHES)); 11 var_dump(filter_var(-1, FILTER_SANITIZE_ADD_SLASHES));
|
H A D | 023.phpt | 2 filter_var() and FILTER_UNSAFE_RAW 8 var_dump(filter_var("}\"<p>test para</p>", FILTER_UNSAFE_RAW, FILTER_FLAG_ENCODE_AMP)); 9 var_dump(filter_var("a[!@#<b>$%^&*()@a@#$%^&*(.<br>com@#$%^&*(", FILTER_UNSAFE_RAW, FILTER_FLAG_ENC… 10 var_dump(filter_var("white space here \ \ \" some more", FILTER_UNSAFE_RAW, FILTER_FLAG_ENCODE_AMP)… 11 var_dump(filter_var("", FILTER_UNSAFE_RAW, FILTER_FLAG_ENCODE_AMP)); 12 var_dump(filter_var(" 123456789000000 <qwertyuiop> ", FILTER_UNSAFE_RAW, FILTER_F…
|
H A D | 038.phpt | 9 $res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL)); 13 $res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL)); 17 $res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_FORCE_AR… 23 $res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_REQUIRE_… 27 $res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_REQUIRE_… 31 $res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_FORCE_AR… 35 $res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_FORCE_AR…
|
H A D | bug80584.phpt | 2 Bug #80584: "0x" and "0X" are considered valid hex numbers by filter_var() 7 var_dump(filter_var('0x', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX)); 8 var_dump(filter_var('0X', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX)); 9 var_dump(filter_var('', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX)); 10 var_dump(filter_var('0', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX));
|
H A D | 056.phpt | 2 filter_var() and FILTER_VALIDATE_DOMAIN 28 var_dump(filter_var($value, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)); 31 var_dump(filter_var('_example.com', FILTER_VALIDATE_DOMAIN)); 32 var_dump(filter_var('_example.com', FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)); 33 var_dump(filter_var('test_.example.com', FILTER_VALIDATE_DOMAIN)); 34 var_dump(filter_var('test_.example.com', FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)); 35 var_dump(filter_var('te_st.example.com', FILTER_VALIDATE_DOMAIN)); 36 var_dump(filter_var('te_st.example.com', FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)); 37 var_dump(filter_var('test._example.com', FILTER_VALIDATE_DOMAIN)); 38 var_dump(filter_var('test._example.com', FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME));
|
H A D | 024.phpt | 2 filter_var() and FILTER_SANITIZE_ENCODED 8 var_dump(filter_var("\"<br>blah</ph>", FILTER_SANITIZE_ENCODED)); 9 var_dump(filter_var("", FILTER_SANITIZE_ENCODED)); 10 var_dump(filter_var(" text here ", FILTER_SANITIZE_ENCODED)); 11 var_dump(filter_var("!@#$%^&*()QWERTYUIOP{ASDFGHJKL:\"ZXCVBNM<>?", FILTER_SANITIZE_ENCODED));
|