diff --git a/ext/standard/tests/file/get_current_user.phpt b/ext/standard/tests/file/get_current_user.phpt new file mode 100644 index 00000000000..ccbd605985c --- /dev/null +++ b/ext/standard/tests/file/get_current_user.phpt @@ -0,0 +1,15 @@ +--TEST-- +get_current_user() tests +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for get_current_user() in %s on line %d +NULL +string(%d) "%s" +Done diff --git a/ext/standard/tests/file/magic_quotes.phpt b/ext/standard/tests/file/magic_quotes.phpt new file mode 100644 index 00000000000..4956f63aa6e --- /dev/null +++ b/ext/standard/tests/file/magic_quotes.phpt @@ -0,0 +1,61 @@ +--TEST-- +various magic quotes tests +--FILE-- + +--EXPECTF-- +int(0) +int(0) +bool(true) +int(1) +bool(true) +int(1) +string(30) "some\'content\'here\"and}there" +bool(true) +int(0) +string(27) "some'content'here"and}there" +bool(true) +int(1) +string(30) "some\'content\'here\"and}there" +bool(true) +bool(false) +int(0) +string(27) "some'content'here"and}there" +Done diff --git a/ext/standard/tests/file/touch.phpt b/ext/standard/tests/file/touch.phpt new file mode 100644 index 00000000000..49baf1dcd98 --- /dev/null +++ b/ext/standard/tests/file/touch.phpt @@ -0,0 +1,49 @@ +--TEST-- +touch() tests +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for touch() in %s on line %d +NULL +bool(true) +int(%d) +bool(true) +int(101) +bool(true) +int(-1) +bool(true) +int(100) +bool(true) +int(100) + +Warning: touch(): Unable to create file /no/such/file/or/directory because No such file or directory in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/general_functions/error_get_last.phpt b/ext/standard/tests/general_functions/error_get_last.phpt new file mode 100644 index 00000000000..3ce1339d1aa --- /dev/null +++ b/ext/standard/tests/general_functions/error_get_last.phpt @@ -0,0 +1,43 @@ +--TEST-- +error_get_last() tests +--FILE-- + +--EXPECTF-- +NULL + +Warning: Wrong parameter count for error_get_last() in %s on line %d +NULL +array(4) { + ["type"]=> + int(2) + ["message"]=> + string(42) "Wrong parameter count for error_get_last()" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) +} + +Notice: Undefined variable: b in %s on line %d +array(4) { + ["type"]=> + int(8) + ["message"]=> + string(21) "Undefined variable: b" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) +} +Done diff --git a/ext/standard/tests/general_functions/import_request.phpt b/ext/standard/tests/general_functions/import_request.phpt new file mode 100644 index 00000000000..23dc049db2b --- /dev/null +++ b/ext/standard/tests/general_functions/import_request.phpt @@ -0,0 +1,78 @@ +--TEST-- +import_request_variables() tests +--GET-- +a=1&b=heh&c=3&d[]=5&GLOBALS=test&1=hm +--POST-- +ap=25&bp=test&cp=blah3&dp[]=ar +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for import_request_variables() in %s on line %d +NULL + +Notice: import_request_variables(): No prefix specified - possible security hazard in %s on line %d +NULL + +Notice: import_request_variables(): No prefix specified - possible security hazard in %s on line %d +NULL + +Notice: import_request_variables(): No prefix specified - possible security hazard in %s on line %d + +Warning: import_request_variables(): Attempted GLOBALS variable overwrite. in %s on line %d + +Warning: import_request_variables(): Numeric key detected - possible security hazard. in %s on line %d +NULL + +Notice: Undefined variable: ap in %s on line %d +string(1) "1" +string(3) "heh" +string(1) "3" +NULL +NULL + +Notice: Undefined variable: g_ap in %s on line %d + +Notice: Undefined variable: g_1 in %s on line %d +string(1) "1" +string(3) "heh" +string(1) "3" +NULL +NULL +NULL +string(1) "1" +string(3) "heh" +string(1) "3" +string(2) "25" +string(4) "test" +string(5) "blah3" +array(1) { + [0]=> + string(2) "ar" +} +NULL + +Notice: Undefined variable: r_ap in %s on line %d +string(1) "1" +string(3) "heh" +string(1) "3" +NULL +Done diff --git a/ext/standard/tests/general_functions/include_path.phpt b/ext/standard/tests/general_functions/include_path.phpt new file mode 100644 index 00000000000..12d7c3f2262 --- /dev/null +++ b/ext/standard/tests/general_functions/include_path.phpt @@ -0,0 +1,75 @@ +--TEST-- +*_include_path() tests +--INI-- +include_path=. +--FILE-- + +--EXPECTF-- +string(1) "." + +Warning: Wrong parameter count for get_include_path() in %s on line %d +NULL +NULL + +Warning: Wrong parameter count for restore_include_path() in %s on line %d +NULL + +Warning: Wrong parameter count for set_include_path() in %s on line %d +NULL +string(1) "." +string(1) "." +string(3) "var" +NULL +string(1) "." +string(1) "." +string(14) ".:/path/to/dir" +NULL +string(1) "." +string(1) "." +string(1) "." +NULL +string(1) "." + +Notice: Array to string conversion in %s on line %d +string(1) "." +string(5) "Array" +NULL +string(1) "." +Done diff --git a/ext/standard/tests/general_functions/parse_ini_file.phpt b/ext/standard/tests/general_functions/parse_ini_file.phpt new file mode 100644 index 00000000000..399a224db95 --- /dev/null +++ b/ext/standard/tests/general_functions/parse_ini_file.phpt @@ -0,0 +1,175 @@ +--TEST-- +parse_ini_file() tests +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for parse_ini_file() in %s on line %d +NULL + +Warning: Wrong parameter count for parse_ini_file() in %s on line %d +NULL + +Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %s on line %d +array(0) { +} + +Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %s on line %d +array(0) { +} +array(1) { + ["test"]=> + string(0) "" +} + +Warning: Error parsing %sparse_ini_file.dat on line 2 + in %s on line %d +array(1) { + ["test"]=> + string(0) "" +} + +Warning: Error parsing %sparse_ini_file.dat on line 2 + in %s on line %d +array(1) { + ["test"]=> + string(4) "test" +} +array(1) { + ["test"]=> + string(8) "new +line" +} +array(1) { + ["test"]=> + string(16) "test const value" +} +array(1) { + ["section"]=> + array(1) { + ["test"]=> + string(5) "hello" + } +} +array(1) { + ["test"]=> + string(5) "hello" +} +array(1) { + ["section.test"]=> + string(5) "hello" +} +array(1) { + ["section"]=> + array(1) { + ["section.test"]=> + string(5) "hello" + } +} +array(1) { + ["section"]=> + array(1) { + [1]=> + string(1) "2" + } +} +array(1) { + [1]=> + string(1) "2" +} +array(1) { + ["test"]=> + string(5) "test4" +} +Done diff --git a/ext/standard/tests/general_functions/rand.phpt b/ext/standard/tests/general_functions/rand.phpt new file mode 100644 index 00000000000..e75bd6d3742 --- /dev/null +++ b/ext/standard/tests/general_functions/rand.phpt @@ -0,0 +1,63 @@ +--TEST-- +rand() and mt_rand() tests +--FILE-- + +--EXPECTF-- +int(%d) + +Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line %d +NULL +int(%i) +int(%d) +int(%d) + +Warning: rand() expects exactly 2 parameters, 1 given in %s on line %d +NULL +int(%i) +int(%d) +NULL +NULL + +Warning: srand() expects parameter 1 to be long, array given in %s on line %d +NULL +NULL +NULL + +Warning: mt_srand() expects parameter 1 to be long, array given in %s on line %d +NULL +int(%d) + +Warning: Wrong parameter count for getrandmax() in %s on line %d +NULL +int(%d) + +Warning: Wrong parameter count for mt_getrandmax() in %s on line %d +NULL +Done diff --git a/ext/standard/tests/general_functions/sys_getloadavg.phpt b/ext/standard/tests/general_functions/sys_getloadavg.phpt new file mode 100644 index 00000000000..9f77863999a --- /dev/null +++ b/ext/standard/tests/general_functions/sys_getloadavg.phpt @@ -0,0 +1,28 @@ +--TEST-- +sys_getloadavg() tests +--FILE-- + +--EXPECTF-- +array(3) { + [0]=> + float(%f) + [1]=> + float(%f) + [2]=> + float(%f) +} +array(3) { + [0]=> + float(%f) + [1]=> + float(%f) + [2]=> + float(%f) +} +Done diff --git a/ext/standard/tests/network/inet.phpt b/ext/standard/tests/network/inet.phpt new file mode 100644 index 00000000000..70d472b5574 --- /dev/null +++ b/ext/standard/tests/network/inet.phpt @@ -0,0 +1,79 @@ +--TEST-- +inet_ntop() & inet_pton() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(9) "127.0.0.1" +string(13) "255.255.255.0" +string(4) "::26" + +Warning: inet_ntop() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: inet_ntop(): Invalid in_addr value in %s on line %d +bool(false) + +Warning: inet_ntop(): Invalid in_addr value in %s on line %d +bool(false) + +Warning: inet_ntop(): Invalid in_addr value in %s on line %d +bool(false) + +Warning: inet_pton() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: inet_pton(): Unrecognized address in %s on line %d +bool(false) + +Warning: inet_pton(): Unrecognized address -1 in %s on line %d +bool(false) + +Warning: inet_pton(): Unrecognized address abra in %s on line %d +bool(false) +string(4) "%s" +string(9) "127.0.0.1" +string(4) "%s" +string(14) "66.163.161.116" +string(4) "%s" +string(15) "255.255.255.255" +string(4) "%s" +string(7) "0.0.0.0" +Done diff --git a/ext/standard/tests/network/ip.phpt b/ext/standard/tests/network/ip.phpt new file mode 100644 index 00000000000..c01fa4e7aa9 --- /dev/null +++ b/ext/standard/tests/network/ip.phpt @@ -0,0 +1,63 @@ +--TEST-- +ip2long() & long2ip() tests +--FILE-- + +--EXPECTF-- +int(2130706433) +string(9) "127.0.0.1" +int(167772161) +string(8) "10.0.0.1" +int(-1) +string(15) "255.255.255.255" +int(-256) +string(13) "255.255.255.0" +int(0) +string(7) "0.0.0.0" +int(1118019956) +string(14) "66.163.161.116" + +Warning: Wrong parameter count for ip2long() in %s on line %d +NULL +int(-1) +bool(false) +int(1869573999) + +Notice: Array to string conversion in %s on line %d +bool(false) + +Warning: Wrong parameter count for long2ip() in %s on line %d +NULL +string(13) "255.254.82.80" +string(7) "0.0.0.0" + +Notice: Array to string conversion in %s on line %d +string(7) "0.0.0.0" +Done diff --git a/ext/standard/tests/strings/highlight_file.phpt b/ext/standard/tests/strings/highlight_file.phpt new file mode 100644 index 00000000000..2c83ee2990d --- /dev/null +++ b/ext/standard/tests/strings/highlight_file.phpt @@ -0,0 +1,68 @@ +--TEST-- +highlight_file() tests +--INI-- +highlight.string=#DD0000 +highlight.comment=#FF9900 +highlight.keyword=#007700 +highlight.bg=#FFFFFF +highlight.default=#0000BB +highlight.html=#000000 +--FILE-- + +DATA; + +file_put_contents($filename, $data); +var_dump(highlight_file($filename)); + +$data = << +DATA; + +file_put_contents($filename, $data); +var_dump(highlight_file($filename)); + +$data = ' +'; + +file_put_contents($filename, $data); +var_dump(highlight_file($filename)); + + +@unlink($filename); +echo "Done\n"; +?> +--EXPECTF-- +Warning: highlight_file() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: highlight_file(%shighlight_file.dat): failed to open stream: No such file or directory in %s on line %d + +Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d +bool(false) + +<?php echo "test"?> + +bool(true) + +<?php echo "test ?> + +bool(true) + +
<?php 
 
class test 
     public 
$var 1
     private function 
foo() { echo "foo"; }
     public function 
bar() { var_dump(test::foo()); }
 }  
?> +
+
bool(true) +Done diff --git a/ext/standard/tests/strings/php_strip_whitespace.phpt b/ext/standard/tests/strings/php_strip_whitespace.phpt new file mode 100644 index 00000000000..4f7ef909e9f --- /dev/null +++ b/ext/standard/tests/strings/php_strip_whitespace.phpt @@ -0,0 +1,52 @@ +--TEST-- +php_strip_whitespace() tests +--FILE-- +'; +file_put_contents($filename, $data); +var_dump(php_strip_whitespace($filename)); + +$data = ''; + +file_put_contents($filename, $data); +var_dump(php_strip_whitespace($filename)); + +@unlink($filename); +echo "Done\n"; +?> +--EXPECTF-- +Warning: php_strip_whitespace() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: php_strip_whitespace(%sphp_strip_whitespace.dat): failed to open stream: No such file or directory in %s on line %d +string(0) "" +string(18) "/* test comment */" +string(9) "" +string(55) "" +Done diff --git a/ext/standard/tests/strings/sha1.phpt b/ext/standard/tests/strings/sha1.phpt index c405eedde59..ed8f47457a0 100644 --- a/ext/standard/tests/strings/sha1.phpt +++ b/ext/standard/tests/strings/sha1.phpt @@ -2,13 +2,50 @@ sha1() with ASCII output --FILE-- ---EXPECT-- -a9993e364706816aba3e25717850c26c9cd0d89d -84983e441c3bd26ebaae4aa1f95129e5e54670f1 -86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 -e0c094e867ef46c350ef54a7f59dd60bed92ae83 +--EXPECTF-- +string(40) "a9993e364706816aba3e25717850c26c9cd0d89d" +string(40) "a9993e364706816aba3e25717850c26c9cd0d89d" +bool(true) +string(40) "84983e441c3bd26ebaae4aa1f95129e5e54670f1" +string(40) "84983e441c3bd26ebaae4aa1f95129e5e54670f1" +bool(true) +string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8" +string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8" +bool(true) +string(40) "e0c094e867ef46c350ef54a7f59dd60bed92ae83" +string(40) "e0c094e867ef46c350ef54a7f59dd60bed92ae83" +bool(true) +string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" +string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" +bool(true) +string(20) "%s" +string(20) "%s" + +Warning: sha1_file(%ssha1.dat): failed to open stream: No such file or directory in %s on line %d +Done