summaryrefslogtreecommitdiff
path: root/sapi/cgi/tests
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/cgi/tests')
-rw-r--r--sapi/cgi/tests/003.phpt12
-rw-r--r--sapi/cgi/tests/004.phpt6
-rw-r--r--sapi/cgi/tests/005-win32.phpt2
-rw-r--r--sapi/cgi/tests/005.phpt2
-rw-r--r--sapi/cgi/tests/006.phpt10
-rw-r--r--sapi/cgi/tests/007.phpt2
-rw-r--r--sapi/cgi/tests/008.phpt10
-rw-r--r--sapi/cgi/tests/011.phpt14
-rw-r--r--sapi/cgi/tests/apache_request_headers.phpt6
-rw-r--r--sapi/cgi/tests/apache_response_headers.phpt2
-rw-r--r--sapi/cgi/tests/bug61605.phpt1
-rw-r--r--sapi/cgi/tests/bug75574_utf8.phpt2
-rw-r--r--sapi/cgi/tests/include.inc103
-rw-r--r--sapi/cgi/tests/skipif.inc4
14 files changed, 84 insertions, 92 deletions
diff --git a/sapi/cgi/tests/003.phpt b/sapi/cgi/tests/003.phpt
index 4b4d29267d..ac3f6aa8e6 100644
--- a/sapi/cgi/tests/003.phpt
+++ b/sapi/cgi/tests/003.phpt
@@ -4,7 +4,7 @@ strip comments and whitespace with -w
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
include "skipif.inc";
@@ -23,12 +23,12 @@ $code ='
/* some test script */
class test { /* {{{ */
- public $var = "test"; //test var
-#perl style comment
- private $pri; /* private attr */
+ public $var = "test"; //test var
+#perl style comment
+ private $pri; /* private attr */
- function foo(/* void */) {
- }
+ function foo(/* void */) {
+ }
}
/* }}} */
diff --git a/sapi/cgi/tests/004.phpt b/sapi/cgi/tests/004.phpt
index b46dce7052..1de856e346 100644
--- a/sapi/cgi/tests/004.phpt
+++ b/sapi/cgi/tests/004.phpt
@@ -17,7 +17,7 @@ $code ='
<?php
class test {
- private $pri;
+ private $pri;
}
var_dump(test::$pri);
@@ -27,9 +27,9 @@ var_dump(test::$pri);
file_put_contents($filename, $code);
if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
- var_dump(`$php -n -f "$filename"`);
+ var_dump(`$php -n -f "$filename"`);
} else {
- var_dump(`$php -n -f "$filename" 2>/dev/null`);
+ var_dump(`$php -n -f "$filename" 2>/dev/null`);
}
var_dump(`$php -n -f "wrong"`);
diff --git a/sapi/cgi/tests/005-win32.phpt b/sapi/cgi/tests/005-win32.phpt
index 1674f16fb9..cafec91d3d 100644
--- a/sapi/cgi/tests/005-win32.phpt
+++ b/sapi/cgi/tests/005-win32.phpt
@@ -4,7 +4,7 @@ using invalid combinations of cmdline options
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
- die ("skip Windows only");
+ die ("skip Windows only");
}
include "skipif.inc";
diff --git a/sapi/cgi/tests/005.phpt b/sapi/cgi/tests/005.phpt
index 6b41f7a99f..a46ac912c7 100644
--- a/sapi/cgi/tests/005.phpt
+++ b/sapi/cgi/tests/005.phpt
@@ -4,7 +4,7 @@ using invalid combinations of cmdline options
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die ("skip not for Windows");
+ die ("skip not for Windows");
}
include "skipif.inc";
diff --git a/sapi/cgi/tests/006.phpt b/sapi/cgi/tests/006.phpt
index c78229880c..479d4a9441 100644
--- a/sapi/cgi/tests/006.phpt
+++ b/sapi/cgi/tests/006.phpt
@@ -19,7 +19,7 @@ $code = '
$test = "var";
class test {
- private $var;
+ private $var;
}
echo test::$var;
@@ -35,8 +35,8 @@ var_dump(`"$php" -n -l some.unknown`);
$code = '
<?php
-class test
- private $var;
+class test
+ private $var;
}
?>
@@ -45,9 +45,9 @@ class test
file_put_contents($filename, $code);
if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
- var_dump(`"$php" -n -l "$filename"`);
+ var_dump(`"$php" -n -l "$filename"`);
} else {
- var_dump(`"$php" -n -l "$filename" 2>/dev/null`);
+ var_dump(`"$php" -n -l "$filename" 2>/dev/null`);
}
@unlink($filename);
diff --git a/sapi/cgi/tests/007.phpt b/sapi/cgi/tests/007.phpt
index 950f451083..96062486e0 100644
--- a/sapi/cgi/tests/007.phpt
+++ b/sapi/cgi/tests/007.phpt
@@ -13,10 +13,8 @@ var_dump(`"$php" -n -f some.php -f some.php`);
var_dump(`"$php" -n -s -w -l`);
?>
-===DONE===
--EXPECT--
string(25) "No input file specified.
"
string(49) "No syntax errors detected in Standard input code
"
-===DONE===
diff --git a/sapi/cgi/tests/008.phpt b/sapi/cgi/tests/008.phpt
index be2fd578e7..05d9d8c190 100644
--- a/sapi/cgi/tests/008.phpt
+++ b/sapi/cgi/tests/008.phpt
@@ -16,12 +16,12 @@ $code = '
$test = "var"; //var
/* test class */
class test {
- private $var = array();
+ private $var = array();
- public static function foo(Test $arg) {
- echo "hello";
- var_dump($this);
- }
+ public static function foo(Test $arg) {
+ echo "hello";
+ var_dump($this);
+ }
}
$o = new test;
diff --git a/sapi/cgi/tests/011.phpt b/sapi/cgi/tests/011.phpt
index 6d4a6ed7f9..263c2e61ef 100644
--- a/sapi/cgi/tests/011.phpt
+++ b/sapi/cgi/tests/011.phpt
@@ -13,13 +13,13 @@ 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);
+ 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 ?>');
diff --git a/sapi/cgi/tests/apache_request_headers.phpt b/sapi/cgi/tests/apache_request_headers.phpt
index bda9ef8b70..647508a64a 100644
--- a/sapi/cgi/tests/apache_request_headers.phpt
+++ b/sapi/cgi/tests/apache_request_headers.phpt
@@ -21,9 +21,9 @@ 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);
+ putenv($name."=".str_repeat("A", 256));
+ passthru("$php -n -q $file");
+ putenv($name);
}
unlink($file);
diff --git a/sapi/cgi/tests/apache_response_headers.phpt b/sapi/cgi/tests/apache_response_headers.phpt
index 99b1352680..bb8b3032ad 100644
--- a/sapi/cgi/tests/apache_response_headers.phpt
+++ b/sapi/cgi/tests/apache_response_headers.phpt
@@ -31,7 +31,6 @@ file_put_contents( $test_file, $code );
passthru( "$php -n -q " . escapeshellarg( $test_file ) );
?>
-===DONE===
--CLEAN--
<?php
@unlink( __DIR__ . DIRECTORY_SEPARATOR ."apache_response_headers.test.php" );
@@ -45,4 +44,3 @@ array(3) {
["Content-type"]=>
string(24) "text/html; charset=UTF-8"
}
-===DONE===
diff --git a/sapi/cgi/tests/bug61605.phpt b/sapi/cgi/tests/bug61605.phpt
index 9c29e6dda2..73b72e24a1 100644
--- a/sapi/cgi/tests/bug61605.phpt
+++ b/sapi/cgi/tests/bug61605.phpt
@@ -18,6 +18,7 @@ $headers3 = headers_list();
print_r($headers1);
print_r($headers2);
print_r($headers3);
+?>
--EXPECTF--
Array
(
diff --git a/sapi/cgi/tests/bug75574_utf8.phpt b/sapi/cgi/tests/bug75574_utf8.phpt
index d7f0e3e5ee..9cbd51abfb 100644
--- a/sapi/cgi/tests/bug75574_utf8.phpt
+++ b/sapi/cgi/tests/bug75574_utf8.phpt
@@ -24,8 +24,6 @@ echo shell_exec("$php -n -f $fn");
unlink($fn);
?>
-===DONE===
--EXPECT--
bool(true)
string(3) "啊"
-===DONE===
diff --git a/sapi/cgi/tests/include.inc b/sapi/cgi/tests/include.inc
index 61b339e49f..de526723df 100644
--- a/sapi/cgi/tests/include.inc
+++ b/sapi/cgi/tests/include.inc
@@ -2,64 +2,61 @@
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;
- if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
- /* On Windows it should be in the same dir as php.exe in most of the cases. */
- $php_path = dirname($php);
-
- if (is_dir($php_path) && file_exists("$php_path/php-cgi.exe") && is_executable("$php_path/php-cgi.exe")) {
- return "$php_path/php-cgi.exe";
- }
- } else {
- 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;
+ $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;
+ if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
+ /* On Windows it should be in the same dir as php.exe in most of the cases. */
+ $cgi_path = dirname($php) . "/php-cgi.exe";
+ if (is_executable($cgi_path)) {
+ return $cgi_path;
+ }
+ } else {
+ /* Try in the same path as php, for the case where php is installed. */
+ $cgi_path = dirname($php) . "/php-cgi";
+ if (is_executable($cgi_path)) {
+ return $cgi_path;
+ }
+
+ /* Try sapi/cgi/php-cgi, for the case where php is not installed. */
+ $cgi_path = dirname($php, 3) . "/sapi/cgi/php-cgi";
+ if (is_executable($cgi_path)) {
+ return $cgi_path;
+ }
+ }
+ 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");
+ 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/sapi/cgi/tests/skipif.inc b/sapi/cgi/tests/skipif.inc
index d2cef23589..2145a9e410 100644
--- a/sapi/cgi/tests/skipif.inc
+++ b/sapi/cgi/tests/skipif.inc
@@ -1,13 +1,13 @@
<?php
if (substr(php_sapi_name(), 0, 3) == "cgi") {
- exit;
+ exit;
}
include dirname(__FILE__)."/include.inc";
if (!get_cgi_path()) {
- die("skip CGI not found");
+ die("skip CGI not found");
}
?>