com phpruntests: compare test failures: QA/results/fail_compa re.php QA/sapi/cgi/tests/001.phpt QA/sapi/cgi/tes ts/002.phpt QA/sapi/cgi/tests/003.phpt
QA/s api/cgi/tests/004.phpt QA/sapi/cgi/tests/005. phpt QA/sapi/cgi/tests/006.diff QA/sapi/cgi/tests/ 006.exp QA/sapi/cgi/tests/006.out QA/sapi/c
gi/tests/006.php QA/sapi/cgi/tests/006.phpt QA/sapi/cgi/tests/007.phpt QA/sapi/cgi/tests/0 08.phpt QA/sapi/cgi/tests/009.phpt QA/sapi/cg
i/tests/010.phpt QA/sapi
| From: | David Soria Parra | Date: | Mon, 06 Jul 2009 21:00:37 +0000 |
| Subject: | com phpruntests: compare test failures: QA/results/fail_compa re.php QA/sapi/cgi/tests/001.phpt QA/sapi/cgi/tes ts/002.phpt QA/sapi/cgi/tests/003.phpt QA/s api/cgi/tests/004.phpt QA/sapi/cgi/tests/005. phpt QA/sapi/cgi/tests/006.diff QA/sapi/cgi/tests/ 006.exp QA/sapi/cgi/tests/006.out QA/sapi/c gi/tests/006.php QA/sapi/cgi/tests/006.phpt QA/sapi/cgi/tests/007.phpt QA/sapi/cgi/tests/0 08.phpt QA/sapi/cgi/tests/009.phpt QA/sapi/cg i/tests/010.phpt QA/sapi |
||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66361@lists.php.net to get a copy of this message | ||
Commit: 0dd2220745104d8be3905c43cf5fc846ec3f1244
Author: Zoe Slattery <zoe@php.net> Mon, 6 Jul 2009 21:00:37 +0000
Parents: 0e364758f88ecfae71bff3dc77c2aa474c0f635b
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=0dd2220745104d8be3905c43cf5fc846ec3f1244
Log:
compare test failures
Changed paths:
A QA/results/fail_compare.php
A QA/sapi/cgi/tests/001.phpt
A QA/sapi/cgi/tests/002.phpt
A QA/sapi/cgi/tests/003.phpt
A QA/sapi/cgi/tests/004.phpt
A QA/sapi/cgi/tests/005.phpt
A QA/sapi/cgi/tests/006.diff
A QA/sapi/cgi/tests/006.exp
A QA/sapi/cgi/tests/006.out
A QA/sapi/cgi/tests/006.php
A QA/sapi/cgi/tests/006.phpt
A QA/sapi/cgi/tests/007.phpt
A QA/sapi/cgi/tests/008.phpt
A QA/sapi/cgi/tests/009.phpt
A QA/sapi/cgi/tests/010.phpt
A QA/sapi/cgi/tests/011.phpt
A QA/sapi/cgi/tests/include.inc
A QA/sapi/cgi/tests/skipif.inc
diff --git a/QA/results/fail_compare.php b/QA/results/fail_compare.php new file mode 100644 index 0000000..78c9a63 --- /dev/null +++ b/QA/results/fail_compare.php @@ -0,0 +1,47 @@ +<?php + +//Compare FAILED tests from run-tests and phpruntests +//php fail_compare.php phprt_ext rt_ext + +$top_level = $argv[3]; + +$mytests = file($argv[1]); +$myfails = array(); + +foreach($mytests as $test) { + if (preg_match("/($top_level\/\S+)\s{1},(.*)\s{1}FAIL\s{1}/", $test, $matches)) { + if(!preg_match("/XFAIL/", $matches[2])) { + $myfails[] = $matches[1] . ".phpt"; + } + } +} + + +$rttests = file($argv[2]); +$rtfails = array(); + +foreach($rttests as $test) { + if (preg_match("/FAIL.*\[(.+\.phpt)\]/", $test, $matches)) { + //echo $matches[1] . "\n"; + $rtfails[] = $matches[1]; + } +} + +$fail_only_my = array_diff($myfails, $rtfails); +$nmy = count($fail_only_my); + +echo "\n =====> $nmy tests fail in phpruntests and do not fail in run-tests\n"; + +foreach($fail_only_my as $fail) { + echo "$fail \n"; +} + +$fail_only_rt = array_diff($rtfails, $myfails); +$nrt = count ($fail_only_rt); + +echo "\n =====> $nrt tests fail in run-tests and do not fail in phpruntests\n"; + +foreach($fail_only_rt as $fail) { + echo "$fail\n"; +} +?> diff --git a/QA/sapi/cgi/tests/001.phpt b/QA/sapi/cgi/tests/001.phpt new file mode 100644 index 0000000..74c694f --- /dev/null +++ b/QA/sapi/cgi/tests/001.phpt @@ -0,0 +1,22 @@ +--TEST-- +version string +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +var_dump(`$php -n -v`); + +echo "Done\n"; +?> +--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/QA/sapi/cgi/tests/002.phpt b/QA/sapi/cgi/tests/002.phpt new file mode 100644 index 0000000..884e652 --- /dev/null +++ b/QA/sapi/cgi/tests/002.phpt @@ -0,0 +1,52 @@ +--TEST-- +defining INI options with -d +--SKIPIF-- +<?php +include "skipif.inc"; +?> +--FILE-- +<?php +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$file = dirname(__FILE__)."/002.test.php"; + +file_put_contents($file, '<?php var_dump(ini_get("max_execution_time")); ?>'); + +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, '<?php var_dump(ini_get("max_execution_time")); var_dump(ini_get("upload_tmp_dir")); ?>'); + +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/QA/sapi/cgi/tests/003.phpt b/QA/sapi/cgi/tests/003.phpt new file mode 100644 index 0000000..5337433 --- /dev/null +++ b/QA/sapi/cgi/tests/003.phpt @@ -0,0 +1,62 @@ +--TEST-- +strip comments and whitespace with -w +--SKIPIF-- +<?php +include "skipif.inc"; +?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$filename = dirname(__FILE__).'/003.test.php'; +$code =' +<?php +/* some test script */ + +class test { /* {{{ */ + public $var = "test"; //test var +#perl style comment + private $pri; /* private attr */ + + function foo(/* void */) { + } +} +/* }}} */ + +?> +'; + +file_put_contents($filename, $code); + +var_dump(`$php -n -w "$filename"`); +var_dump(`$php -n -w "wrong"`); +var_dump(`echo "<?php /* comment */ class test {\n // comment \n function foo() {} } ?>" | $php -n -w`); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html%r; charset=.*|%r + + +<?php + class test { public $var = "test"; private $pri; function foo() { } } ?> +" +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 + +<?php class test { function foo() {} } ?> +" +Done diff --git a/QA/sapi/cgi/tests/004.phpt b/QA/sapi/cgi/tests/004.phpt new file mode 100644 index 0000000..c841b68 --- /dev/null +++ b/QA/sapi/cgi/tests/004.phpt @@ -0,0 +1,43 @@ +--TEST-- +execute a file with -f +--SKIPIF-- +<?php +include "skipif.inc"; +?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$filename = dirname(__FILE__).'/004.test.php'; +$code =' +<?php + +class test { + private $pri; +} + +var_dump(test::$pri); +?> +'; + +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) " +<br /> +<b>Fatal error</b>: Cannot access private property test::$pri in <b>%s004.test.php</b> on line <b>8</b><br /> +" +string(25) "No input file specified. +" +Done diff --git a/QA/sapi/cgi/tests/005.phpt b/QA/sapi/cgi/tests/005.phpt new file mode 100644 index 0000000..34a28f9 --- /dev/null +++ b/QA/sapi/cgi/tests/005.phpt @@ -0,0 +1,27 @@ +--TEST-- +using invalid combinations of cmdline options +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +var_dump(`$php -n -a -f 'wrong'`); +var_dump(`$php -n -f 'wrong' -a`); + +echo "Done\n"; +?> +--EXPECTF-- +string(51) "No input file specified. +Interactive mode enabled + +" +string(51) "No input file specified. +Interactive mode enabled + +" +Done diff --git a/QA/sapi/cgi/tests/006.diff b/QA/sapi/cgi/tests/006.diff new file mode 100644 index 0000000..678f931 --- /dev/null +++ b/QA/sapi/cgi/tests/006.diff @@ -0,0 +1,3 @@ +006+ <font size='1'><table dir='ltr' border='1' cellspacing='0' cellpadding='1'> +007+ <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Parse error: syntax error, unexpected T_PRIVATE, expecting '{' in /mnt/workspace/php53_tmp/sapi/cgi/tests/006.test.php on line <i>5</i></th></tr> +006- <b>Parse error</b>: %s expecting %s{%s in <b>%s006.test.php</b> on line <b>5</b><br /> \ No newline at end of file diff --git a/QA/sapi/cgi/tests/006.exp b/QA/sapi/cgi/tests/006.exp new file mode 100644 index 0000000..6d48199 --- /dev/null +++ b/QA/sapi/cgi/tests/006.exp @@ -0,0 +1,9 @@ +string(%d) "No syntax errors detected in %s006.test.php +" +string(%d) "No input file specified. +" +string(%d) "<br /> +<b>Parse error</b>: %s expecting %s{%s in <b>%s006.test.php</b> on line <b>5</b><br /> +Errors parsing %s006.test.php +" +Done \ No newline at end of file diff --git a/QA/sapi/cgi/tests/006.out b/QA/sapi/cgi/tests/006.out new file mode 100644 index 0000000..478ddff --- /dev/null +++ b/QA/sapi/cgi/tests/006.out @@ -0,0 +1,10 @@ +string(82) "No syntax errors detected in /mnt/workspace/php53_tmp/sapi/cgi/tests/006.test.php +" +string(25) "No input file specified. +" +string(438) "<br /> +<font size='1'><table dir='ltr' border='1' cellspacing='0' cellpadding='1'> +<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Parse error: syntax error, unexpected T_PRIVATE, expecting '{' in /mnt/workspace/php53_tmp/sapi/cgi/tests/006.test.php on line <i>5</i></th></tr> +Errors parsing /mnt/workspace/php53_tmp/sapi/cgi/tests/006.test.php +" +Done \ No newline at end of file diff --git a/QA/sapi/cgi/tests/006.php b/QA/sapi/cgi/tests/006.php new file mode 100644 index 0000000..e30eb33 --- /dev/null +++ b/QA/sapi/cgi/tests/006.php @@ -0,0 +1,45 @@ +<?php +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$filename = dirname(__FILE__)."/006.test.php"; + +$code = ' +<?php + +$test = "var"; + +class test { + private $var; +} + +echo test::$var; + +?> +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -n -l "$filename"`); +var_dump(`"$php" -n -l some.unknown`); + +$code = ' +<?php + +class test + private $var; +} + +?> +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -l "$filename" 2>/dev/null`); + +@unlink($filename); + +echo "Done\n"; +?> diff --git a/QA/sapi/cgi/tests/006.phpt b/QA/sapi/cgi/tests/006.phpt new file mode 100644 index 0000000..e183fea --- /dev/null +++ b/QA/sapi/cgi/tests/006.phpt @@ -0,0 +1,60 @@ +--TEST-- +syntax check +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$filename = dirname(__FILE__)."/006.test.php"; + +$code = ' +<?php + +$test = "var"; + +class test { + private $var; +} + +echo test::$var; + +?> +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -n -l "$filename"`); +var_dump(`"$php" -n -l some.unknown`); + +$code = ' +<?php + +class test + private $var; +} + +?> +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -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) "<br /> +<b>Parse error</b>: %s expecting %s{%s in <b>%s006.test.php</b> on line <b>5</b><br /> +Errors parsing %s006.test.php +" +Done diff --git a/QA/sapi/cgi/tests/007.phpt b/QA/sapi/cgi/tests/007.phpt new file mode 100644 index 0000000..f2c9c02 --- /dev/null +++ b/QA/sapi/cgi/tests/007.phpt @@ -0,0 +1,22 @@ +--TEST-- +invalid arguments and error messages +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +var_dump(`"$php" -n -f some.php -f some.php`); +var_dump(`"$php" -n -s -w -l`); + +?> +===DONE=== +--EXPECTF-- +string(25) "No input file specified. +" +string(31) "No syntax errors detected in - +" +===DONE=== diff --git a/QA/sapi/cgi/tests/008.phpt b/QA/sapi/cgi/tests/008.phpt new file mode 100644 index 0000000..7537664 --- /dev/null +++ b/QA/sapi/cgi/tests/008.phpt @@ -0,0 +1,54 @@ +--TEST-- +syntax highlighting +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$filename = dirname(__FILE__)."/008.test.php"; +$code = ' +<?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; +?> +'; + +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 + +<code><span style="color: #000000"> +<br /><span style="color: #0000BB"><?php<br />$test </span><span style="color: #007700">= </span><span style="color: #DD0000">"var"</span><span style="color: #007700">; </span><span style="color: #FF8000">//var<br />/* test class */<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">test </span><span style="color: #007700">{<br /> private </span><span style="color: #0000BB">$var </span><span style="color: #007700">= array();<br /><br /> public static function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">Test $arg</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"hello"</span><span style="color: #007700">;<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">);<br /> }<br />}<br /><br /></span><span style="color: #0000BB">$o </span><span style="color: #007700">= new </span><span style="color: #0000BB">test</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?><br /></span> +</span> +</code>" +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/QA/sapi/cgi/tests/009.phpt b/QA/sapi/cgi/tests/009.phpt new file mode 100644 index 0000000..c8e9ae1 --- /dev/null +++ b/QA/sapi/cgi/tests/009.phpt @@ -0,0 +1,30 @@ +--TEST-- +path info request without exported PATH_INFO +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$f = tempnam(sys_get_temp_dir(), 'cgitest'); + +putenv("TRANSLATED_PATH=".$f."/x"); +putenv("SCRIPT_FILENAME=".$f."/x"); +file_put_contents($f, '<?php var_dump($_SERVER["TRANSLATED_PATH"]); ?>'); + +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/QA/sapi/cgi/tests/010.phpt b/QA/sapi/cgi/tests/010.phpt new file mode 100644 index 0000000..e633ad2 --- /dev/null +++ b/QA/sapi/cgi/tests/010.phpt @@ -0,0 +1,53 @@ +--TEST-- +Bug #45860 (header() function fails to correctly replace all Status lines) +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$f = tempnam(sys_get_temp_dir(), 'cgitest'); + +putenv("TRANSLATED_PATH=".$f."/x"); +putenv("SCRIPT_FILENAME=".$f."/x"); +file_put_contents($f, '<?php +header("HTTP/1.1 403 Forbidden"); +header("Status: 403 Also Forbidden"); +?>'); + +echo (`$php -n $f`); + +file_put_contents($f, '<?php +header("HTTP/1.1 403 Forbidden"); +?>'); + +echo (`$php -n $f`); + +file_put_contents($f, '<?php +header("Status: 403 Also Forbidden"); +?>'); + +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/QA/sapi/cgi/tests/011.phpt b/QA/sapi/cgi/tests/011.phpt new file mode 100644 index 0000000..177df02 --- /dev/null +++ b/QA/sapi/cgi/tests/011.phpt @@ -0,0 +1,165 @@ +--TEST-- +header_remove() +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$f = tempnam(sys_get_temp_dir(), 'cgitest'); + +function test($script) { + file_put_contents($GLOBALS['f'], $script); + $cmd = escapeshellcmd($GLOBALS['php']); + $cmd .= ' -n -dreport_zend_debug=0 -dhtml_errors=0 ' . escapeshellarg($GLOBALS['f']); + echo "----------\n"; + echo rtrim($script) . "\n"; + echo "----------\n"; + passthru($cmd); +} + +test('<?php ?>'); +test('<?php header_remove(); ?>'); +test('<?php header_remove("X-Foo"); ?>'); +test('<?php +header("X-Foo: Bar"); +?>'); +test('<?php +header("X-Foo: Bar"); +header("X-Bar: Baz"); +header_remove("X-Foo"); +?>'); +test('<?php +header("X-Foo: Bar"); +header_remove("X-Foo: Bar"); +?>'); +test('<?php +header("X-Foo: Bar"); +header_remove("X-Foo:"); +?>'); +test('<?php +header("X-Foo: Bar"); +header_remove(); +?>'); +test('<?php +header_remove(""); +?>'); +test('<?php +header_remove(":"); +?>'); +test('<?php +header("X-Foo: Bar"); +echo "flush\n"; +flush(); +header_remove("X-Foo"); +?>'); + +@unlink($f); +?> +--EXPECTF-- +---------- +<?php ?> +---------- +X-Powered-By: PHP/%s +Content-type: text/html + +---------- +<?php header_remove(); ?> +---------- +Content-type: text/html + +---------- +<?php header_remove("X-Foo"); ?> +---------- +X-Powered-By: PHP/%s +Content-type: text/html + +---------- +<?php +header("X-Foo: Bar"); +?> +---------- +X-Powered-By: PHP/%s +X-Foo: Bar +Content-type: text/html + +---------- +<?php +header("X-Foo: Bar"); +header("X-Bar: Baz"); +header_remove("X-Foo"); +?> +---------- +X-Powered-By: PHP/%s +X-Bar: Baz +Content-type: text/html + +---------- +<?php +header("X-Foo: Bar"); +header_remove("X-Foo: Bar"); +?> +---------- +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 +---------- +<?php +header("X-Foo: Bar"); +header_remove("X-Foo:"); +?> +---------- +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 +---------- +<?php +header("X-Foo: Bar"); +header_remove(); +?> +---------- +Content-type: text/html + +---------- +<?php +header_remove(""); +?> +---------- +X-Powered-By: PHP/%s +Content-type: text/html + +---------- +<?php +header_remove(":"); +?> +---------- +X-Powered-By: PHP/%s +Content-type: text/html + + +Warning: Header to delete may not contain colon. in %s on line 2 +---------- +<?php +header("X-Foo: Bar"); +echo "flush\n"; +flush(); +header_remove("X-Foo"); +?> +---------- +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/QA/sapi/cgi/tests/include.inc b/QA/sapi/cgi/tests/include.inc new file mode 100644 index 0000000..2d8ed8a --- /dev/null +++ b/QA/sapi/cgi/tests/include.inc @@ -0,0 +1,57 @@ +<?php + +function get_cgi_path() /* {{{ */ +{ + $php = getenv("TEST_PHP_EXECUTABLE"); + + $cli = false; + $cgi = false; + + if (file_exists($php) && is_executable($php)) { + $version = `$php -n -v`; + if (strstr($version, "(cli)")) { + /* that's cli */ + $cli = true; + } else if (strpos($version, "(cgi")) { + /* that's cgi */ + return $php; + } + } + + if ($cli) { + /* trying to guess ... */ + $php_path = $php; + for ($i = 0; $i < 2; $i++) { + $slash_pos = strrpos($php_path, "/"); + if ($slash_pos) { + $php_path = substr($php_path, 0, $slash_pos); + } else { + return FALSE; + } + } + + if ($php_path && is_dir($php_path) && file_exists($php_path."/cgi/php-cgi") && is_executable($php_path."/cgi/php-cgi")) { + /* gotcha */ + return $php_path."/cgi/php-cgi"; + } + return false; + } + /* uhm? what's that then? */ + return false; +} +/* }}} */ + +function reset_env_vars() /* {{{ */ +{ + putenv("REDIRECT_STATUS"); + putenv("QUERY_STRING"); + putenv("PATH_TRANSLATED"); + putenv("SCRIPT_FILENAME"); + putenv("SERVER_SOFTWARE"); + putenv("SERVER_NAME"); + putenv("GATEWAY_INTERFACE"); + putenv("REQUEST_METHOD"); +} +/* }}} */ + +?> diff --git a/QA/sapi/cgi/tests/skipif.inc b/QA/sapi/cgi/tests/skipif.inc new file mode 100644 index 0000000..9da8b79 --- /dev/null +++ b/QA/sapi/cgi/tests/skipif.inc @@ -0,0 +1,17 @@ +<?php + +if (substr(php_sapi_name(), 0, 3) == "cgi") { + exit; +} + +if (substr(PHP_OS, 0, 3) == 'WIN') { + die ("skip not for Windows"); +} + +include dirname(__FILE__)."/include.inc"; + +if (!get_cgi_path()) { + die("skip CGI not found"); +} + +?>
diff --git a/QA/results/fail_compare.php b/QA/results/fail_compare.php new file mode 100644 index 0000000..78c9a63 --- /dev/null +++ b/QA/results/fail_compare.php @@ -0,0 +1,47 @@ +<?php + +//Compare FAILED tests from run-tests and phpruntests +//php fail_compare.php phprt_ext rt_ext + +$top_level = $argv[3]; + +$mytests = file($argv[1]); +$myfails = array(); + +foreach($mytests as $test) { + if (preg_match("/($top_level\/\S+)\s{1},(.*)\s{1}FAIL\s{1}/", $test, $matches)) { + if(!preg_match("/XFAIL/", $matches[2])) { + $myfails[] = $matches[1] . ".phpt"; + } + } +} + + +$rttests = file($argv[2]); +$rtfails = array(); + +foreach($rttests as $test) { + if (preg_match("/FAIL.*\[(.+\.phpt)\]/", $test, $matches)) { + //echo $matches[1] . "\n"; + $rtfails[] = $matches[1]; + } +} + +$fail_only_my = array_diff($myfails, $rtfails); +$nmy = count($fail_only_my); + +echo "\n =====> $nmy tests fail in phpruntests and do not fail in run-tests\n"; + +foreach($fail_only_my as $fail) { + echo "$fail \n"; +} + +$fail_only_rt = array_diff($rtfails, $myfails); +$nrt = count ($fail_only_rt); + +echo "\n =====> $nrt tests fail in run-tests and do not fail in phpruntests\n"; + +foreach($fail_only_rt as $fail) { + echo "$fail\n"; +} +?> diff --git a/QA/sapi/cgi/tests/001.phpt b/QA/sapi/cgi/tests/001.phpt new file mode 100644 index 0000000..74c694f --- /dev/null +++ b/QA/sapi/cgi/tests/001.phpt @@ -0,0 +1,22 @@ +--TEST-- +version string +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +var_dump(`$php -n -v`); + +echo "Done\n"; +?> +--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/QA/sapi/cgi/tests/002.phpt b/QA/sapi/cgi/tests/002.phpt new file mode 100644 index 0000000..884e652 --- /dev/null +++ b/QA/sapi/cgi/tests/002.phpt @@ -0,0 +1,52 @@ +--TEST-- +defining INI options with -d +--SKIPIF-- +<?php +include "skipif.inc"; +?> +--FILE-- +<?php +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$file = dirname(__FILE__)."/002.test.php"; + +file_put_contents($file, '<?php var_dump(ini_get("max_execution_time")); ?>'); + +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, '<?php var_dump(ini_get("max_execution_time")); var_dump(ini_get("upload_tmp_dir")); ?>'); + +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/QA/sapi/cgi/tests/003.phpt b/QA/sapi/cgi/tests/003.phpt new file mode 100644 index 0000000..5337433 --- /dev/null +++ b/QA/sapi/cgi/tests/003.phpt @@ -0,0 +1,62 @@ +--TEST-- +strip comments and whitespace with -w +--SKIPIF-- +<?php +include "skipif.inc"; +?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$filename = dirname(__FILE__).'/003.test.php'; +$code =' +<?php +/* some test script */ + +class test { /* {{{ */ + public $var = "test"; //test var +#perl style comment + private $pri; /* private attr */ + + function foo(/* void */) { + } +} +/* }}} */ + +?> +'; + +file_put_contents($filename, $code); + +var_dump(`$php -n -w "$filename"`); +var_dump(`$php -n -w "wrong"`); +var_dump(`echo "<?php /* comment */ class test {\n // comment \n function foo() {} } ?>" | $php -n -w`); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html%r; charset=.*|%r + + +<?php + class test { public $var = "test"; private $pri; function foo() { } } ?> +" +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 + +<?php class test { function foo() {} } ?> +" +Done diff --git a/QA/sapi/cgi/tests/004.phpt b/QA/sapi/cgi/tests/004.phpt new file mode 100644 index 0000000..c841b68 --- /dev/null +++ b/QA/sapi/cgi/tests/004.phpt @@ -0,0 +1,43 @@ +--TEST-- +execute a file with -f +--SKIPIF-- +<?php +include "skipif.inc"; +?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$filename = dirname(__FILE__).'/004.test.php'; +$code =' +<?php + +class test { + private $pri; +} + +var_dump(test::$pri); +?> +'; + +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) " +<br /> +<b>Fatal error</b>: Cannot access private property test::$pri in <b>%s004.test.php</b> on line <b>8</b><br /> +" +string(25) "No input file specified. +" +Done diff --git a/QA/sapi/cgi/tests/005.phpt b/QA/sapi/cgi/tests/005.phpt new file mode 100644 index 0000000..34a28f9 --- /dev/null +++ b/QA/sapi/cgi/tests/005.phpt @@ -0,0 +1,27 @@ +--TEST-- +using invalid combinations of cmdline options +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +var_dump(`$php -n -a -f 'wrong'`); +var_dump(`$php -n -f 'wrong' -a`); + +echo "Done\n"; +?> +--EXPECTF-- +string(51) "No input file specified. +Interactive mode enabled + +" +string(51) "No input file specified. +Interactive mode enabled + +" +Done diff --git a/QA/sapi/cgi/tests/006.diff b/QA/sapi/cgi/tests/006.diff new file mode 100644 index 0000000..678f931 --- /dev/null +++ b/QA/sapi/cgi/tests/006.diff @@ -0,0 +1,3 @@ +006+ <font size='1'><table dir='ltr' border='1' cellspacing='0' cellpadding='1'> +007+ <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Parse error: syntax error, unexpected T_PRIVATE, expecting '{' in /mnt/workspace/php53_tmp/sapi/cgi/tests/006.test.php on line <i>5</i></th></tr> +006- <b>Parse error</b>: %s expecting %s{%s in <b>%s006.test.php</b> on line <b>5</b><br /> \ No newline at end of file diff --git a/QA/sapi/cgi/tests/006.exp b/QA/sapi/cgi/tests/006.exp new file mode 100644 index 0000000..6d48199 --- /dev/null +++ b/QA/sapi/cgi/tests/006.exp @@ -0,0 +1,9 @@ +string(%d) "No syntax errors detected in %s006.test.php +" +string(%d) "No input file specified. +" +string(%d) "<br /> +<b>Parse error</b>: %s expecting %s{%s in <b>%s006.test.php</b> on line <b>5</b><br /> +Errors parsing %s006.test.php +" +Done \ No newline at end of file diff --git a/QA/sapi/cgi/tests/006.out b/QA/sapi/cgi/tests/006.out new file mode 100644 index 0000000..478ddff --- /dev/null +++ b/QA/sapi/cgi/tests/006.out @@ -0,0 +1,10 @@ +string(82) "No syntax errors detected in /mnt/workspace/php53_tmp/sapi/cgi/tests/006.test.php +" +string(25) "No input file specified. +" +string(438) "<br /> +<font size='1'><table dir='ltr' border='1' cellspacing='0' cellpadding='1'> +<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Parse error: syntax error, unexpected T_PRIVATE, expecting '{' in /mnt/workspace/php53_tmp/sapi/cgi/tests/006.test.php on line <i>5</i></th></tr> +Errors parsing /mnt/workspace/php53_tmp/sapi/cgi/tests/006.test.php +" +Done \ No newline at end of file diff --git a/QA/sapi/cgi/tests/006.php b/QA/sapi/cgi/tests/006.php new file mode 100644 index 0000000..e30eb33 --- /dev/null +++ b/QA/sapi/cgi/tests/006.php @@ -0,0 +1,45 @@ +<?php +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$filename = dirname(__FILE__)."/006.test.php"; + +$code = ' +<?php + +$test = "var"; + +class test { + private $var; +} + +echo test::$var; + +?> +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -n -l "$filename"`); +var_dump(`"$php" -n -l some.unknown`); + +$code = ' +<?php + +class test + private $var; +} + +?> +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -l "$filename" 2>/dev/null`); + +@unlink($filename); + +echo "Done\n"; +?> diff --git a/QA/sapi/cgi/tests/006.phpt b/QA/sapi/cgi/tests/006.phpt new file mode 100644 index 0000000..e183fea --- /dev/null +++ b/QA/sapi/cgi/tests/006.phpt @@ -0,0 +1,60 @@ +--TEST-- +syntax check +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$filename = dirname(__FILE__)."/006.test.php"; + +$code = ' +<?php + +$test = "var"; + +class test { + private $var; +} + +echo test::$var; + +?> +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -n -l "$filename"`); +var_dump(`"$php" -n -l some.unknown`); + +$code = ' +<?php + +class test + private $var; +} + +?> +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -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) "<br /> +<b>Parse error</b>: %s expecting %s{%s in <b>%s006.test.php</b> on line <b>5</b><br /> +Errors parsing %s006.test.php +" +Done diff --git a/QA/sapi/cgi/tests/007.phpt b/QA/sapi/cgi/tests/007.phpt new file mode 100644 index 0000000..f2c9c02 --- /dev/null +++ b/QA/sapi/cgi/tests/007.phpt @@ -0,0 +1,22 @@ +--TEST-- +invalid arguments and error messages +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +var_dump(`"$php" -n -f some.php -f some.php`); +var_dump(`"$php" -n -s -w -l`); + +?> +===DONE=== +--EXPECTF-- +string(25) "No input file specified. +" +string(31) "No syntax errors detected in - +" +===DONE=== diff --git a/QA/sapi/cgi/tests/008.phpt b/QA/sapi/cgi/tests/008.phpt new file mode 100644 index 0000000..7537664 --- /dev/null +++ b/QA/sapi/cgi/tests/008.phpt @@ -0,0 +1,54 @@ +--TEST-- +syntax highlighting +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$filename = dirname(__FILE__)."/008.test.php"; +$code = ' +<?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; +?> +'; + +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 + +<code><span style="color: #000000"> +<br /><span style="color: #0000BB"><?php<br />$test </span><span style="color: #007700">= </span><span style="color: #DD0000">"var"</span><span style="color: #007700">; </span><span style="color: #FF8000">//var<br />/* test class */<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">test </span><span style="color: #007700">{<br /> private </span><span style="color: #0000BB">$var </span><span style="color: #007700">= array();<br /><br /> public static function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">Test $arg</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"hello"</span><span style="color: #007700">;<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">);<br /> }<br />}<br /><br /></span><span style="color: #0000BB">$o </span><span style="color: #007700">= new </span><span style="color: #0000BB">test</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?><br /></span> +</span> +</code>" +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/QA/sapi/cgi/tests/009.phpt b/QA/sapi/cgi/tests/009.phpt new file mode 100644 index 0000000..c8e9ae1 --- /dev/null +++ b/QA/sapi/cgi/tests/009.phpt @@ -0,0 +1,30 @@ +--TEST-- +path info request without exported PATH_INFO +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$f = tempnam(sys_get_temp_dir(), 'cgitest'); + +putenv("TRANSLATED_PATH=".$f."/x"); +putenv("SCRIPT_FILENAME=".$f."/x"); +file_put_contents($f, '<?php var_dump($_SERVER["TRANSLATED_PATH"]); ?>'); + +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/QA/sapi/cgi/tests/010.phpt b/QA/sapi/cgi/tests/010.phpt new file mode 100644 index 0000000..e633ad2 --- /dev/null +++ b/QA/sapi/cgi/tests/010.phpt @@ -0,0 +1,53 @@ +--TEST-- +Bug #45860 (header() function fails to correctly replace all Status lines) +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$f = tempnam(sys_get_temp_dir(), 'cgitest'); + +putenv("TRANSLATED_PATH=".$f."/x"); +putenv("SCRIPT_FILENAME=".$f."/x"); +file_put_contents($f, '<?php +header("HTTP/1.1 403 Forbidden"); +header("Status: 403 Also Forbidden"); +?>'); + +echo (`$php -n $f`); + +file_put_contents($f, '<?php +header("HTTP/1.1 403 Forbidden"); +?>'); + +echo (`$php -n $f`); + +file_put_contents($f, '<?php +header("Status: 403 Also Forbidden"); +?>'); + +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/QA/sapi/cgi/tests/011.phpt b/QA/sapi/cgi/tests/011.phpt new file mode 100644 index 0000000..177df02 --- /dev/null +++ b/QA/sapi/cgi/tests/011.phpt @@ -0,0 +1,165 @@ +--TEST-- +header_remove() +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +include "include.inc"; + +$php = get_cgi_path(); +reset_env_vars(); + +$f = tempnam(sys_get_temp_dir(), 'cgitest'); + +function test($script) { + file_put_contents($GLOBALS['f'], $script); + $cmd = escapeshellcmd($GLOBALS['php']); + $cmd .= ' -n -dreport_zend_debug=0 -dhtml_errors=0 ' . escapeshellarg($GLOBALS['f']); + echo "----------\n"; + echo rtrim($script) . "\n"; + echo "----------\n"; + passthru($cmd); +} + +test('<?php ?>'); +test('<?php header_remove(); ?>'); +test('<?php header_remove("X-Foo"); ?>'); +test('<?php +header("X-Foo: Bar"); +?>'); +test('<?php +header("X-Foo: Bar"); +header("X-Bar: Baz"); +header_remove("X-Foo"); +?>'); +test('<?php +header("X-Foo: Bar"); +header_remove("X-Foo: Bar"); +?>'); +test('<?php +header("X-Foo: Bar"); +header_remove("X-Foo:"); +?>'); +test('<?php +header("X-Foo: Bar"); +header_remove(); +?>'); +test('<?php +header_remove(""); +?>'); +test('<?php +header_remove(":"); +?>'); +test('<?php +header("X-Foo: Bar"); +echo "flush\n"; +flush(); +header_remove("X-Foo"); +?>'); + +@unlink($f); +?> +--EXPECTF-- +---------- +<?php ?> +---------- +X-Powered-By: PHP/%s +Content-type: text/html + +---------- +<?php header_remove(); ?> +---------- +Content-type: text/html + +---------- +<?php header_remove("X-Foo"); ?> +---------- +X-Powered-By: PHP/%s +Content-type: text/html + +---------- +<?php +header("X-Foo: Bar"); +?> +---------- +X-Powered-By: PHP/%s +X-Foo: Bar +Content-type: text/html + +---------- +<?php +header("X-Foo: Bar"); +header("X-Bar: Baz"); +header_remove("X-Foo"); +?> +---------- +X-Powered-By: PHP/%s +X-Bar: Baz +Content-type: text/html + +---------- +<?php +header("X-Foo: Bar"); +header_remove("X-Foo: Bar"); +?> +---------- +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 +---------- +<?php +header("X-Foo: Bar"); +header_remove("X-Foo:"); +?> +---------- +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 +---------- +<?php +header("X-Foo: Bar"); +header_remove(); +?> +---------- +Content-type: text/html + +---------- +<?php +header_remove(""); +?> +---------- +X-Powered-By: PHP/%s +Content-type: text/html + +---------- +<?php +header_remove(":"); +?> +---------- +X-Powered-By: PHP/%s +Content-type: text/html + + +Warning: Header to delete may not contain colon. in %s on line 2 +---------- +<?php +header("X-Foo: Bar"); +echo "flush\n"; +flush(); +header_remove("X-Foo"); +?> +---------- +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/QA/sapi/cgi/tests/include.inc b/QA/sapi/cgi/tests/include.inc new file mode 100644 index 0000000..2d8ed8a --- /dev/null +++ b/QA/sapi/cgi/tests/include.inc @@ -0,0 +1,57 @@ +<?php + +function get_cgi_path() /* {{{ */ +{ + $php = getenv("TEST_PHP_EXECUTABLE"); + + $cli = false; + $cgi = false; + + if (file_exists($php) && is_executable($php)) { + $version = `$php -n -v`; + if (strstr($version, "(cli)")) { + /* that's cli */ + $cli = true; + } else if (strpos($version, "(cgi")) { + /* that's cgi */ + return $php; + } + } + + if ($cli) { + /* trying to guess ... */ + $php_path = $php; + for ($i = 0; $i < 2; $i++) { + $slash_pos = strrpos($php_path, "/"); + if ($slash_pos) { + $php_path = substr($php_path, 0, $slash_pos); + } else { + return FALSE; + } + } + + if ($php_path && is_dir($php_path) && file_exists($php_path."/cgi/php-cgi") && is_executable($php_path."/cgi/php-cgi")) { + /* gotcha */ + return $php_path."/cgi/php-cgi"; + } + return false; + } + /* uhm? what's that then? */ + return false; +} +/* }}} */ + +function reset_env_vars() /* {{{ */ +{ + putenv("REDIRECT_STATUS"); + putenv("QUERY_STRING"); + putenv("PATH_TRANSLATED"); + putenv("SCRIPT_FILENAME"); + putenv("SERVER_SOFTWARE"); + putenv("SERVER_NAME"); + putenv("GATEWAY_INTERFACE"); + putenv("REQUEST_METHOD"); +} +/* }}} */ + +?> diff --git a/QA/sapi/cgi/tests/skipif.inc b/QA/sapi/cgi/tests/skipif.inc new file mode 100644 index 0000000..9da8b79 --- /dev/null +++ b/QA/sapi/cgi/tests/skipif.inc @@ -0,0 +1,17 @@ +<?php + +if (substr(php_sapi_name(), 0, 3) == "cgi") { + exit; +} + +if (substr(PHP_OS, 0, 3) == 'WIN') { + die ("skip not for Windows"); +} + +include dirname(__FILE__)."/include.inc"; + +if (!get_cgi_path()) { + die("skip CGI not found"); +} + +?>