Merge branch 'PHP-7.0'

* PHP-7.0:
  fork test
  fix tests on Windows
  tweak cgi binary search
This commit is contained in:
Anatol Belski committed 2015-09-30 11:32:26 +02:00
commit f27efe828e
7 files changed
+77 -18

No files matched your search

+5
View File
@@ -2,6 +2,11 @@
strip comments and whitespace with -w
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
include "skipif.inc";
?>
--FILE--
+5 -1
View File
@@ -26,7 +26,11 @@ var_dump(test::$pri);
file_put_contents($filename, $code);
var_dump(`$php -n -f "$filename" 2>/dev/null`);
if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
var_dump(`$php -n -f "$filename"`);
} else {
var_dump(`$php -n -f "$filename" 2>/dev/null`);
}
var_dump(`$php -n -f "wrong"`);
@unlink($filename);
+34
View File
@@ -0,0 +1,34 @@
--TEST--
using invalid combinations of cmdline options
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
die ("skip Windows only");
}
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) "Interactive mode enabled
No input file specified.
"
string(51) "Interactive mode enabled
No input file specified.
"
Done
+8 -1
View File
@@ -1,7 +1,14 @@
--TEST--
using invalid combinations of cmdline options
--SKIPIF--
<?php include "skipif.inc"; ?>
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
include "skipif.inc";
?>
--FILE--
<?php
+5 -1
View File
@@ -44,7 +44,11 @@ class test
file_put_contents($filename, $code);
var_dump(`"$php" -n -l "$filename" 2>/dev/null`);
if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
var_dump(`"$php" -n -l "$filename"`);
} else {
var_dump(`"$php" -n -l "$filename" 2>/dev/null`);
}
@unlink($filename);
+20 -11
View File
@@ -21,18 +21,27 @@ function get_cgi_path() /* {{{ */
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 (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 ($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";
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;
}
-4
View File
@@ -4,10 +4,6 @@ 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()) {