From c4dd7a1a684490673e25aaf4fabec5df138854c4 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Thu, 14 Mar 2013 05:42:27 +0000 Subject: Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2. --- sapi/cgi/tests/001.phpt | 22 ++++ sapi/cgi/tests/002.phpt | 52 +++++++++ sapi/cgi/tests/003.phpt | 62 +++++++++++ sapi/cgi/tests/004.phpt | 43 ++++++++ sapi/cgi/tests/005.phpt | 27 +++++ sapi/cgi/tests/006.phpt | 62 +++++++++++ sapi/cgi/tests/007.phpt | 22 ++++ sapi/cgi/tests/008.phpt | 54 ++++++++++ sapi/cgi/tests/009.phpt | 30 ++++++ sapi/cgi/tests/010.phpt | 53 +++++++++ sapi/cgi/tests/011.phpt | 165 +++++++++++++++++++++++++++++ sapi/cgi/tests/apache_request_headers.phpt | 51 +++++++++ sapi/cgi/tests/bug61605.phpt | 34 ++++++ sapi/cgi/tests/include.inc | 57 ++++++++++ sapi/cgi/tests/skipif.inc | 17 +++ 15 files changed, 751 insertions(+) create mode 100644 sapi/cgi/tests/001.phpt create mode 100644 sapi/cgi/tests/002.phpt create mode 100644 sapi/cgi/tests/003.phpt create mode 100644 sapi/cgi/tests/004.phpt create mode 100644 sapi/cgi/tests/005.phpt create mode 100644 sapi/cgi/tests/006.phpt create mode 100644 sapi/cgi/tests/007.phpt create mode 100644 sapi/cgi/tests/008.phpt create mode 100644 sapi/cgi/tests/009.phpt create mode 100644 sapi/cgi/tests/010.phpt create mode 100644 sapi/cgi/tests/011.phpt create mode 100644 sapi/cgi/tests/apache_request_headers.phpt create mode 100644 sapi/cgi/tests/bug61605.phpt create mode 100644 sapi/cgi/tests/include.inc create mode 100644 sapi/cgi/tests/skipif.inc (limited to 'sapi/cgi/tests') diff --git a/sapi/cgi/tests/001.phpt b/sapi/cgi/tests/001.phpt new file mode 100644 index 0000000..74c694f --- /dev/null +++ b/sapi/cgi/tests/001.phpt @@ -0,0 +1,22 @@ +--TEST-- +version string +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(%d) "PHP %s (cgi%s (built: %s +Copyright (c) 1997-20%s The PHP Group +Zend Engine v%s, Copyright (c) 1998-20%s Zend Technologies +" +Done diff --git a/sapi/cgi/tests/002.phpt b/sapi/cgi/tests/002.phpt new file mode 100644 index 0000000..884e652 --- /dev/null +++ b/sapi/cgi/tests/002.phpt @@ -0,0 +1,52 @@ +--TEST-- +defining INI options with -d +--SKIPIF-- + +--FILE-- +'); + +var_dump(`$php -n -d max_execution_time=111 $file`); +var_dump(`$php -n -d max_execution_time=500 $file`); +var_dump(`$php -n -d max_execution_time=500 -d max_execution_time=555 $file`); + +file_put_contents($file, ''); + +var_dump(`$php -n -d upload_tmp_dir=/test/path -d max_execution_time=555 $file`); + +unlink($file); + +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html%r; charset=.*|%r + +%unicode|string%(3) "111" +" +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html%r; charset=.*|%r + +%unicode|string%(3) "500" +" +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html%r; charset=.*|%r + +%unicode|string%(3) "555" +" +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html%r; charset=.*|%r + +%unicode|string%(3) "555" +%unicode|string%(10) "/test/path" +" +Done diff --git a/sapi/cgi/tests/003.phpt b/sapi/cgi/tests/003.phpt new file mode 100644 index 0000000..5337433 --- /dev/null +++ b/sapi/cgi/tests/003.phpt @@ -0,0 +1,62 @@ +--TEST-- +strip comments and whitespace with -w +--SKIPIF-- + +--FILE-- + +'; + +file_put_contents($filename, $code); + +var_dump(`$php -n -w "$filename"`); +var_dump(`$php -n -w "wrong"`); +var_dump(`echo "" | $php -n -w`); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html%r; charset=.*|%r + + + +" +string(%d) "Status: 404 Not Found +X-Powered-By: PHP/%s +Content-type: text/html%r; charset=.*|%r + +No input file specified. +" +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html%r; charset=.*|%r + + +" +Done diff --git a/sapi/cgi/tests/004.phpt b/sapi/cgi/tests/004.phpt new file mode 100644 index 0000000..c841b68 --- /dev/null +++ b/sapi/cgi/tests/004.phpt @@ -0,0 +1,43 @@ +--TEST-- +execute a file with -f +--SKIPIF-- + +--FILE-- + +'; + +file_put_contents($filename, $code); + +var_dump(`$php -n -f "$filename" 2>/dev/null`); +var_dump(`$php -n -f "wrong"`); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(%d) " +
+Fatal error: Cannot access private property test::$pri in %s004.test.php on line 8
+" +string(25) "No input file specified. +" +Done diff --git a/sapi/cgi/tests/005.phpt b/sapi/cgi/tests/005.phpt new file mode 100644 index 0000000..34a28f9 --- /dev/null +++ b/sapi/cgi/tests/005.phpt @@ -0,0 +1,27 @@ +--TEST-- +using invalid combinations of cmdline options +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(51) "No input file specified. +Interactive mode enabled + +" +string(51) "No input file specified. +Interactive mode enabled + +" +Done diff --git a/sapi/cgi/tests/006.phpt b/sapi/cgi/tests/006.phpt new file mode 100644 index 0000000..a2b2b29 --- /dev/null +++ b/sapi/cgi/tests/006.phpt @@ -0,0 +1,62 @@ +--TEST-- +syntax check +--SKIPIF-- + +--INI-- +display_errors=stdout +--FILE-- + +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -n -l "$filename"`); +var_dump(`"$php" -n -l some.unknown`); + +$code = ' + +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -n -l "$filename" 2>/dev/null`); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "No syntax errors detected in %s006.test.php +" +string(%d) "No input file specified. +" +string(%d) "
+Parse error: %s expecting %s{%s in %s006.test.php on line 5
+Errors parsing %s006.test.php +" +Done diff --git a/sapi/cgi/tests/007.phpt b/sapi/cgi/tests/007.phpt new file mode 100644 index 0000000..f2c9c02 --- /dev/null +++ b/sapi/cgi/tests/007.phpt @@ -0,0 +1,22 @@ +--TEST-- +invalid arguments and error messages +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +string(25) "No input file specified. +" +string(31) "No syntax errors detected in - +" +===DONE=== diff --git a/sapi/cgi/tests/008.phpt b/sapi/cgi/tests/008.phpt new file mode 100644 index 0000000..7537664 --- /dev/null +++ b/sapi/cgi/tests/008.phpt @@ -0,0 +1,54 @@ +--TEST-- +syntax highlighting +--SKIPIF-- + +--FILE-- + +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -n -s "$filename"`); +var_dump(`"$php" -n -s "unknown"`); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html%r; charset=.*|%r + + +
<?php
$test 
"var"//var
/* test class */
class test {
    private 
$var = array();

    public static function 
foo(Test $arg) {
        echo 
"hello";
        
var_dump($this);
    }
}

$o = new test;
?>
+
+
" +string(%d) "Status: 404 Not Found +X-Powered-By: PHP/%s +Content-type: text/html%r; charset=.*|%r + +No input file specified. +" +Done diff --git a/sapi/cgi/tests/009.phpt b/sapi/cgi/tests/009.phpt new file mode 100644 index 0000000..c8e9ae1 --- /dev/null +++ b/sapi/cgi/tests/009.phpt @@ -0,0 +1,30 @@ +--TEST-- +path info request without exported PATH_INFO +--SKIPIF-- + +--FILE-- +'); + +echo (`$php -n $f`); + +echo "Done\n"; + +@unlink($f); +?> +--EXPECTF-- +X-Powered-By: PHP/%s +Content-type: text/html%r; charset=.*|%r + +string(%d) "%s/x" +Done diff --git a/sapi/cgi/tests/010.phpt b/sapi/cgi/tests/010.phpt new file mode 100644 index 0000000..e633ad2 --- /dev/null +++ b/sapi/cgi/tests/010.phpt @@ -0,0 +1,53 @@ +--TEST-- +Bug #45860 (header() function fails to correctly replace all Status lines) +--SKIPIF-- + +--FILE-- +'); + +echo (`$php -n $f`); + +file_put_contents($f, ''); + +echo (`$php -n $f`); + +file_put_contents($f, ''); + +echo (`$php -n $f`); + +echo "Done\n"; + +@unlink($f); +?> +--EXPECTF-- +Status: 403 Forbidden +X-Powered-By: PHP/%s +Content-type: text/html + +Status: 403 Forbidden +X-Powered-By: PHP/%s +Content-type: text/html + +X-Powered-By: PHP/%s +Status: 403 Also Forbidden +Content-type: text/html + +Done diff --git a/sapi/cgi/tests/011.phpt b/sapi/cgi/tests/011.phpt new file mode 100644 index 0000000..177df02 --- /dev/null +++ b/sapi/cgi/tests/011.phpt @@ -0,0 +1,165 @@ +--TEST-- +header_remove() +--SKIPIF-- + +--FILE-- +'); +test(''); +test(''); +test(''); +test(''); +test(''); +test(''); +test(''); +test(''); +test(''); +test(''); + +@unlink($f); +?> +--EXPECTF-- +---------- + +---------- +X-Powered-By: PHP/%s +Content-type: text/html + +---------- + +---------- +Content-type: text/html + +---------- + +---------- +X-Powered-By: PHP/%s +Content-type: text/html + +---------- + +---------- +X-Powered-By: PHP/%s +X-Foo: Bar +Content-type: text/html + +---------- + +---------- +X-Powered-By: PHP/%s +X-Bar: Baz +Content-type: text/html + +---------- + +---------- +X-Powered-By: PHP/%s +X-Foo: Bar +Content-type: text/html + + +Warning: Header to delete may not contain colon. in %s on line 3 +---------- + +---------- +X-Powered-By: PHP/%s +X-Foo: Bar +Content-type: text/html + + +Warning: Header to delete may not contain colon. in %s on line 3 +---------- + +---------- +Content-type: text/html + +---------- + +---------- +X-Powered-By: PHP/%s +Content-type: text/html + +---------- + +---------- +X-Powered-By: PHP/%s +Content-type: text/html + + +Warning: Header to delete may not contain colon. in %s on line 2 +---------- + +---------- +X-Powered-By: PHP/%s +X-Foo: Bar +Content-type: text/html + +flush + +Warning: Cannot modify header information - headers already sent by (output started at %s:3) in %s on line 5 diff --git a/sapi/cgi/tests/apache_request_headers.phpt b/sapi/cgi/tests/apache_request_headers.phpt new file mode 100644 index 0000000..fd36e30 --- /dev/null +++ b/sapi/cgi/tests/apache_request_headers.phpt @@ -0,0 +1,51 @@ +--TEST-- +apache_request_headers() stack overflow. +--INI-- +default_charset="UTF-8" +--SKIPIF-- + +--FILE-- +'); + +passthru("$php -n $file"); + +$names = array('HTTP_X_TEST', 'HTTP_X__TEST', 'HTTP_X_'); +foreach ($names as $name) { + putenv($name."=".str_repeat("A", 256)); + passthru("$php -n -q $file"); + putenv($name); +} +unlink($file); + +echo "Done\n"; +?> +--EXPECTF-- +X-Powered-By: PHP/%s +Content-type: text/%s + +Array +( +) +Array +( + [X-Test] => AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +) +Array +( + [X-_test] => AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +) +Array +( + [X-] => AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +) +Done diff --git a/sapi/cgi/tests/bug61605.phpt b/sapi/cgi/tests/bug61605.phpt new file mode 100644 index 0000000..c6e4cf2 --- /dev/null +++ b/sapi/cgi/tests/bug61605.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #61605 (header_remove() does not remove all headers) +--SKIPIF-- + +--GET-- +foo=bar +--FILE-- + X-Powered-By: %s + [1] => A: second +) +Array +( + [0] => X-Powered-By: %s + [1] => A: second + [2] => A: third +) +Array +( + [0] => X-Powered-By: %s +) diff --git a/sapi/cgi/tests/include.inc b/sapi/cgi/tests/include.inc new file mode 100644 index 0000000..2d8ed8a --- /dev/null +++ b/sapi/cgi/tests/include.inc @@ -0,0 +1,57 @@ + diff --git a/sapi/cgi/tests/skipif.inc b/sapi/cgi/tests/skipif.inc new file mode 100644 index 0000000..9da8b79 --- /dev/null +++ b/sapi/cgi/tests/skipif.inc @@ -0,0 +1,17 @@ + -- cgit v1.2.1