diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/basic/021.phpt | 2 | ||||
| -rw-r--r-- | tests/basic/bug46313-win.phpt | 5 | ||||
| -rw-r--r-- | tests/basic/bug51709_1.phpt | 2 | ||||
| -rw-r--r-- | tests/basic/bug51709_2.phpt | 2 | ||||
| -rw-r--r-- | tests/basic/bug53180.phpt | 19 | ||||
| -rw-r--r-- | tests/basic/rfc1867_max_file_uploads_empty_files.phpt | 101 | ||||
| -rw-r--r-- | tests/basic/rfc1867_max_file_uploads_empty_files_debug.phpt | 102 | ||||
| -rw-r--r-- | tests/classes/constants_error_004.phpt | 2 | ||||
| -rw-r--r-- | tests/output/bug46897.phpt | 4 | ||||
| -rw-r--r-- | tests/output/ob_clean_basic_001.phpt | 4 | ||||
| -rw-r--r-- | tests/output/ob_end_clean_basic_001.phpt | 4 | ||||
| -rw-r--r-- | tests/output/ob_end_flush_basic_001.phpt | 6 | ||||
| -rw-r--r-- | tests/output/ob_flush_basic_001.phpt | 4 | ||||
| -rw-r--r-- | tests/output/ob_get_level_basic_001.phpt | 4 | ||||
| -rw-r--r-- | tests/output/ob_start_basic_unerasable_002.phpt | 8 | ||||
| -rw-r--r-- | tests/output/ob_start_basic_unerasable_003.phpt | 4 | ||||
| -rw-r--r-- | tests/output/ob_start_basic_unerasable_004.phpt | 2 | ||||
| -rw-r--r-- | tests/output/ob_start_basic_unerasable_005.phpt | 4 | ||||
| -rw-r--r-- | tests/output/ob_start_callbacks.phpt | 39 | ||||
| -rw-r--r-- | tests/security/bug53226.phpt | 29 |
20 files changed, 318 insertions, 29 deletions
diff --git a/tests/basic/021.phpt b/tests/basic/021.phpt index bce6bb3c9..e79ac7dc2 100644 --- a/tests/basic/021.phpt +++ b/tests/basic/021.phpt @@ -1,7 +1,7 @@ --TEST-- Bug #37276 (problems witch $_POST array) --INI-- -file_upload=1 +file_uploads=1 --POST_RAW-- Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737 -----------------------------20896060251896012921717172737 diff --git a/tests/basic/bug46313-win.phpt b/tests/basic/bug46313-win.phpt index 1971e807b..87786d44e 100644 --- a/tests/basic/bug46313-win.phpt +++ b/tests/basic/bug46313-win.phpt @@ -28,6 +28,8 @@ var_dump($GLOBALS["o1\'file"]); var_dump($GLOBALS["o1\'file"] === $_FILES["o1\'file"]["tmp_name"]); ?> --EXPECTF-- +Deprecated: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0 +Deprecated: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0 array(2) { ["o1\'file"]=> array(5) { @@ -60,6 +62,3 @@ string(12) "o1" bool(true) string(%d) "%s" bool(true) -Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0 -Warning: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0 - diff --git a/tests/basic/bug51709_1.phpt b/tests/basic/bug51709_1.phpt index e929df384..8abb92555 100644 --- a/tests/basic/bug51709_1.phpt +++ b/tests/basic/bug51709_1.phpt @@ -13,4 +13,4 @@ class foo { ===DONE=== <?php exit(0); ?> --EXPECTF-- -Parse error: syntax error, unexpected T_FOR, expecting T_STRING in %s/bug51709_1.php on line %d +Parse error: syntax error, unexpected T_FOR, expecting T_STRING in %sbug51709_1.php on line %d diff --git a/tests/basic/bug51709_2.phpt b/tests/basic/bug51709_2.phpt index b6224abcf..7763cafe5 100644 --- a/tests/basic/bug51709_2.phpt +++ b/tests/basic/bug51709_2.phpt @@ -13,4 +13,4 @@ class foo { ===DONE=== <?php exit(0); ?> --EXPECTF-- -Parse error: syntax error, unexpected T_GOTO, expecting T_STRING in %s/bug51709_2.php on line %d +Parse error: syntax error, unexpected T_GOTO, expecting T_STRING in %sbug51709_2.php on line %d diff --git a/tests/basic/bug53180.phpt b/tests/basic/bug53180.phpt new file mode 100644 index 000000000..5c2eb7695 --- /dev/null +++ b/tests/basic/bug53180.phpt @@ -0,0 +1,19 @@ +--TEST--
+Bug #53180 (post_max_size=0 partly not working)
+--INI--
+post_max_size=0
+--POST--
+email=foo&password=bar&submit=Log+on
+--FILE--
+<?php
+var_dump($_POST);
+?>
+--EXPECT--
+array(3) {
+ ["email"]=>
+ string(3) "foo"
+ ["password"]=>
+ string(3) "bar"
+ ["submit"]=>
+ string(6) "Log on"
+}
diff --git a/tests/basic/rfc1867_max_file_uploads_empty_files.phpt b/tests/basic/rfc1867_max_file_uploads_empty_files.phpt new file mode 100644 index 000000000..76327fdb0 --- /dev/null +++ b/tests/basic/rfc1867_max_file_uploads_empty_files.phpt @@ -0,0 +1,101 @@ +--TEST--
+rfc1867 max_file_uploads - empty files shouldn't count (non-debug version)
+--SKIPIF--
+<?php if(function_exists("leak")) print "skip only for non-debug builds"; ?>
+--INI--
+file_uploads=1
+error_reporting=E_ALL
+max_file_uploads=2
+--POST_RAW--
+Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="file2"; filename=""
+Content-Type: text/plain-file
+
+
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="file3"; filename=""
+Content-Type: text/plain-file
+
+33
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="file4"; filename="file4.txt"
+Content-Type: text/plain-file
+
+
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="file1"; filename="file1.txt"
+Content-Type: text/plain-file
+
+1
+-----------------------------20896060251896012921717172737--
+--FILE--
+<?php
+var_dump($_FILES);
+var_dump($_POST);
+if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {
+ var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
+}
+if (is_uploaded_file($_FILES["file4"]["tmp_name"])) {
+ var_dump(file_get_contents($_FILES["file4"]["tmp_name"]));
+}
+?>
+--EXPECTF--
+array(4) {
+ ["file2"]=>
+ array(5) {
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ string(0) ""
+ ["tmp_name"]=>
+ string(0) ""
+ ["error"]=>
+ int(4)
+ ["size"]=>
+ int(0)
+ }
+ ["file3"]=>
+ array(5) {
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ string(0) ""
+ ["tmp_name"]=>
+ string(0) ""
+ ["error"]=>
+ int(4)
+ ["size"]=>
+ int(0)
+ }
+ ["file4"]=>
+ array(5) {
+ ["name"]=>
+ string(9) "file4.txt"
+ ["type"]=>
+ string(15) "text/plain-file"
+ ["tmp_name"]=>
+ string(%d) "%s"
+ ["error"]=>
+ int(0)
+ ["size"]=>
+ int(0)
+ }
+ ["file1"]=>
+ array(5) {
+ ["name"]=>
+ string(9) "file1.txt"
+ ["type"]=>
+ string(15) "text/plain-file"
+ ["tmp_name"]=>
+ string(%d) "%s"
+ ["error"]=>
+ int(0)
+ ["size"]=>
+ int(1)
+ }
+}
+array(0) {
+}
+string(1) "1"
+string(0) ""
diff --git a/tests/basic/rfc1867_max_file_uploads_empty_files_debug.phpt b/tests/basic/rfc1867_max_file_uploads_empty_files_debug.phpt new file mode 100644 index 000000000..279851cc2 --- /dev/null +++ b/tests/basic/rfc1867_max_file_uploads_empty_files_debug.phpt @@ -0,0 +1,102 @@ +--TEST--
+rfc1867 max_file_uploads - empty files shouldn't count (debug version)
+--SKIPIF--
+<?php if(!function_exists("leak")) print "skip only for debug builds"; ?>
+--INI--
+file_uploads=1
+error_reporting=E_ALL
+max_file_uploads=1
+--POST_RAW--
+Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="file2"; filename=""
+Content-Type: text/plain-file
+
+
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="file3"; filename=""
+Content-Type: text/plain-file
+
+33
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="file4"; filename="file4.txt"
+Content-Type: text/plain-file
+
+
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="file1"; filename="file1.txt"
+Content-Type: text/plain-file
+
+1
+-----------------------------20896060251896012921717172737--
+--FILE--
+<?php
+var_dump($_FILES);
+var_dump($_POST);
+if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {
+ var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
+}
+?>
+--EXPECTF--
+Notice: No file uploaded in Unknown on line 0
+
+Notice: No file uploaded in Unknown on line 0
+
+Warning: Uploaded file size 0 - file [file4=file4.txt] not saved in Unknown on line 0
+array(4) {
+ ["file2"]=>
+ array(5) {
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ string(0) ""
+ ["tmp_name"]=>
+ string(0) ""
+ ["error"]=>
+ int(4)
+ ["size"]=>
+ int(0)
+ }
+ ["file3"]=>
+ array(5) {
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ string(0) ""
+ ["tmp_name"]=>
+ string(0) ""
+ ["error"]=>
+ int(4)
+ ["size"]=>
+ int(0)
+ }
+ ["file4"]=>
+ array(5) {
+ ["name"]=>
+ string(9) "file4.txt"
+ ["type"]=>
+ string(0) ""
+ ["tmp_name"]=>
+ string(0) ""
+ ["error"]=>
+ int(5)
+ ["size"]=>
+ int(0)
+ }
+ ["file1"]=>
+ array(5) {
+ ["name"]=>
+ string(9) "file1.txt"
+ ["type"]=>
+ string(15) "text/plain-file"
+ ["tmp_name"]=>
+ string(%d) "%s"
+ ["error"]=>
+ int(0)
+ ["size"]=>
+ int(1)
+ }
+}
+array(0) {
+}
+string(1) "1"
diff --git a/tests/classes/constants_error_004.phpt b/tests/classes/constants_error_004.phpt index 732c530e8..03e67258a 100644 --- a/tests/classes/constants_error_004.phpt +++ b/tests/classes/constants_error_004.phpt @@ -10,4 +10,4 @@ Class constant whose initial value refereces a non-existent class $a = new C(); ?> --EXPECTF-- -Fatal error: Undefined class constant 'D::hello' in %s on line %d +Fatal error: Class 'D' not found in %s on line %d diff --git a/tests/output/bug46897.phpt b/tests/output/bug46897.phpt index 6cfb10253..a77db91d3 100644 --- a/tests/output/bug46897.phpt +++ b/tests/output/bug46897.phpt @@ -18,10 +18,10 @@ echo 'Done'; ?> --EXPECTF-- [callback:1]Attempt to flush unerasable buffer - should fail... -Notice: ob_flush(): failed to flush buffer callback. in %s on line %d +Notice: ob_flush(): failed to flush buffer callback in %s on line %d bool(false) string(%d) "Attempt to flush unerasable buffer - should fail... -Notice: ob_flush(): failed to flush buffer callback. in %s on line %d +Notice: ob_flush(): failed to flush buffer callback in %s on line %d bool(false) " Done diff --git a/tests/output/ob_clean_basic_001.phpt b/tests/output/ob_clean_basic_001.phpt index c93bea358..afaa7e2f4 100644 --- a/tests/output/ob_clean_basic_001.phpt +++ b/tests/output/ob_clean_basic_001.phpt @@ -29,8 +29,8 @@ echo "Done"; -- Testing ob_clean() function with Zero arguments -- -Notice: ob_clean(): failed to delete buffer. No buffer to delete. in %s on line 12 +Notice: ob_clean(): failed to delete buffer. No buffer to delete in %s on line 12 bool(false) string(61) "bool(true) Ensure the buffer is still active after the clean." -Done
\ No newline at end of file +Done diff --git a/tests/output/ob_end_clean_basic_001.phpt b/tests/output/ob_end_clean_basic_001.phpt index 0b694e36c..54e840bdb 100644 --- a/tests/output/ob_end_clean_basic_001.phpt +++ b/tests/output/ob_end_clean_basic_001.phpt @@ -21,11 +21,11 @@ var_dump(ob_end_clean()); ?> --EXPECTF-- -Notice: ob_end_clean(): failed to delete buffer. No buffer to delete. in %s on line 7 +Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in %s on line 7 bool(false) bool(true) bool(true) -Notice: ob_end_clean(): failed to delete buffer. No buffer to delete. in %s on line 16 +Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in %s on line 16 bool(false) diff --git a/tests/output/ob_end_flush_basic_001.phpt b/tests/output/ob_end_flush_basic_001.phpt index 7515face0..cba780276 100644 --- a/tests/output/ob_end_flush_basic_001.phpt +++ b/tests/output/ob_end_flush_basic_001.phpt @@ -30,12 +30,12 @@ echo "Done"; -- Testing ob_end_flush() function with Zero arguments -- -Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush. in %s on line 12 +Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line 12 bool(false) bool(true) Hello bool(true) -Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush. in %s on line 21 +Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line 21 bool(false) -Done
\ No newline at end of file +Done diff --git a/tests/output/ob_flush_basic_001.phpt b/tests/output/ob_flush_basic_001.phpt index 91fb69526..57de5e31a 100644 --- a/tests/output/ob_flush_basic_001.phpt +++ b/tests/output/ob_flush_basic_001.phpt @@ -30,10 +30,10 @@ echo "Done"; -- Testing ob_flush() function with Zero arguments -- -Notice: ob_flush(): failed to flush buffer. No buffer to flush. in %s on line 12 +Notice: ob_flush(): failed to flush buffer. No buffer to flush in %s on line 12 bool(false) This should get flushed. bool(true) Ensure the buffer is still active after the flush. bool(true) -Done
\ No newline at end of file +Done diff --git a/tests/output/ob_get_level_basic_001.phpt b/tests/output/ob_get_level_basic_001.phpt index 78217e4a4..65f329135 100644 --- a/tests/output/ob_get_level_basic_001.phpt +++ b/tests/output/ob_get_level_basic_001.phpt @@ -42,6 +42,6 @@ int(2) int(1) int(0) -Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush. in %s on line 26 +Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line 26 int(0) -Done
\ No newline at end of file +Done diff --git a/tests/output/ob_start_basic_unerasable_002.phpt b/tests/output/ob_start_basic_unerasable_002.phpt index 2ffcbb9dc..3b8bd637e 100644 --- a/tests/output/ob_start_basic_unerasable_002.phpt +++ b/tests/output/ob_start_basic_unerasable_002.phpt @@ -21,13 +21,13 @@ var_dump(ob_get_level()); --EXPECTF-- [callback:1]All of the following calls will fail to clean/remove the topmost buffer: -Notice: ob_clean(): failed to delete buffer callback. in %s on line 11 +Notice: ob_clean(): failed to delete buffer callback in %s on line 11 bool(false) -Notice: ob_end_clean(): failed to delete buffer callback. in %s on line 12 +Notice: ob_end_clean(): failed to delete buffer callback in %s on line 12 bool(false) -Notice: ob_end_flush(): failed to delete buffer callback. in %s on line 13 +Notice: ob_end_flush(): failed to delete buffer callback in %s on line 13 bool(false) The OB nesting will still be 1 level deep: -int(1)
\ No newline at end of file +int(1) diff --git a/tests/output/ob_start_basic_unerasable_003.phpt b/tests/output/ob_start_basic_unerasable_003.phpt index d20141453..e35902c89 100644 --- a/tests/output/ob_start_basic_unerasable_003.phpt +++ b/tests/output/ob_start_basic_unerasable_003.phpt @@ -17,5 +17,5 @@ var_dump($str); --EXPECTF-- [callback:1]This call will fail to obtain the content, since it is also requesting a clean: -Notice: ob_get_clean(): failed to delete buffer callback. in %s on line 11 -bool(false)
\ No newline at end of file +Notice: ob_get_clean(): failed to delete buffer callback in %s on line 11 +bool(false) diff --git a/tests/output/ob_start_basic_unerasable_004.phpt b/tests/output/ob_start_basic_unerasable_004.phpt index 6669856d6..081875a78 100644 --- a/tests/output/ob_start_basic_unerasable_004.phpt +++ b/tests/output/ob_start_basic_unerasable_004.phpt @@ -17,5 +17,5 @@ var_dump($str); --EXPECTF-- [callback:1]This call will fail to flush and fail to obtain the content: -Notice: ob_get_flush(): failed to delete buffer callback. in %s on line 11 +Notice: ob_get_flush(): failed to delete buffer callback in %s on line 11 bool(false) diff --git a/tests/output/ob_start_basic_unerasable_005.phpt b/tests/output/ob_start_basic_unerasable_005.phpt index 7be71e5aa..f1af201e6 100644 --- a/tests/output/ob_start_basic_unerasable_005.phpt +++ b/tests/output/ob_start_basic_unerasable_005.phpt @@ -17,9 +17,9 @@ var_dump(ob_get_contents()); ?> --EXPECTF-- [callback:1]Attempt to flush unerasable buffer - should fail... -Notice: ob_flush(): failed to flush buffer callback. in %s on line 11 +Notice: ob_flush(): failed to flush buffer callback in %s on line 11 bool(false) string(%d) "Attempt to flush unerasable buffer - should fail... -Notice: ob_flush(): failed to flush buffer callback. in %s on line 11 +Notice: ob_flush(): failed to flush buffer callback in %s on line 11 bool(false) " diff --git a/tests/output/ob_start_callbacks.phpt b/tests/output/ob_start_callbacks.phpt new file mode 100644 index 000000000..da52d85f7 --- /dev/null +++ b/tests/output/ob_start_callbacks.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test ob_start() with callbacks in variables +--FILE-- +<?php + +// Closure in variable +$a = function ($s) { return strtoupper($s); }; +ob_start($a); +echo 'closure in variable', "\n"; +ob_end_flush(); + +// Object (array) in variable +class foo { + static function out($foo) { + return strtoupper($foo); + } +} +$a = array('foo', 'out'); +ob_start($a); +echo 'object in variable', "\n"; +ob_end_flush(); + +// Object with static array +ob_start(array('foo', 'out')); +echo 'object via static array', "\n"; +ob_end_flush(); + +function my_strtoupper($foo, $bar) { + return strtoupper($foo); +} +$a = 'my_strtoupper'; +ob_start($a); +echo 'function via variable', "\n"; +ob_end_flush(); +--EXPECT-- +CLOSURE IN VARIABLE +OBJECT IN VARIABLE +OBJECT VIA STATIC ARRAY +FUNCTION VIA VARIABLE diff --git a/tests/security/bug53226.phpt b/tests/security/bug53226.phpt new file mode 100644 index 000000000..9556e4668 --- /dev/null +++ b/tests/security/bug53226.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #53226 (file_exists fails on big filenames) +--INI-- +open_basedir=. +--FILE-- +<?php +require_once "open_basedir.inc"; +create_directories(); + +var_dump(file_exists('./test/ok/ok.txt')); +var_dump(file_exists('./test/foo')); + +$file = str_repeat('x', 2 * PHP_MAXPATHLEN); +var_dump(file_exists("./test/$file")); +?> +--CLEAN-- +<?php +require_once "open_basedir.inc"; +delete_directories(); +?> +--EXPECTF-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) + +Warning: file_exists(): File name is longer than the maximum allowed path length on this platform (%d): %s in %s on line %d +bool(false) |
