mirror of
https://github.com/php/php-src.git
synced 2026-10-29 02:07:35 +08:00
Several of these tests fail to pass TEST_PHP_EXTRA_ARGS to the PHP binary they execute. This can lead to spurious failures when, for example, the system's INI file is incompatible with the just-built CLI php: ---- EXPECTED OUTPUT int(111) ---- ACTUAL OUTPUT Failed loading /usr/lib64/php8.2/lib64/opcache.so: /usr/lib64/php8.2/lib64/opcache.so: undefined symbol: _emalloc_32 int(111) ---- FAILED This commit adds TEST_PHP_EXTRA_ARGS to the "php" invocations that are missing them, allowing the user to run "run-tests.php -n" to work around the problem.
80 lines
1.6 KiB
PHP
80 lines
1.6 KiB
PHP
--TEST--
|
|
Bug #78323 Test exit code and error message for invalid parameters
|
|
--SKIPIF--
|
|
<?php
|
|
include "skipif.inc";
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$php = getenv('TEST_PHP_EXECUTABLE_ESCAPED');
|
|
$args = getenv('TEST_PHP_EXTRA_ARGS');
|
|
|
|
// There are 3 types of option errors:
|
|
// 1 : in flags
|
|
// 2 option not found
|
|
// 3 no argument for option
|
|
|
|
|
|
// colon in flags
|
|
ob_start();
|
|
passthru("$php $args -a:Z 2>&1", $exitCode);
|
|
$output = ob_get_contents();
|
|
ob_end_clean();
|
|
|
|
$lines = preg_split('/\R/', $output);
|
|
echo $lines[0], "\n",
|
|
$lines[1], "\n",
|
|
"Done: $exitCode\n\n";
|
|
|
|
|
|
// option not found
|
|
ob_start();
|
|
passthru("$php $args -Z 2>&1", $exitCode);
|
|
$output = ob_get_contents();
|
|
ob_end_clean();
|
|
|
|
$lines = preg_split('/\R/', $output);
|
|
echo $lines[0], "\n",
|
|
$lines[1], "\n",
|
|
"Done: $exitCode\n\n";
|
|
|
|
|
|
// no argument for option
|
|
ob_start();
|
|
passthru("$php $args --memory-limit=1G 2>&1", $exitCode);
|
|
$output = ob_get_contents();
|
|
ob_end_clean();
|
|
|
|
$lines = preg_split('/\R/', $output);
|
|
echo $lines[0], "\n",
|
|
$lines[1], "\n",
|
|
"Done: $exitCode\n\n";
|
|
|
|
|
|
// Successful execution
|
|
ob_start();
|
|
passthru("$php $args -dmemory-limit=1G -v", $exitCode);
|
|
$output = ob_get_contents();
|
|
ob_end_clean();
|
|
|
|
$lines = preg_split('/\R/', $output);
|
|
echo $lines[0], "\n",
|
|
"Done: $exitCode\n";
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Error in argument %d, char %d: : in flags
|
|
Usage: %s [options] [-f] <file> [--] [args...]
|
|
Done: 1
|
|
|
|
Error in argument %d, char %d: option not found %s
|
|
Usage: %s [options] [-f] <file> [--] [args...]
|
|
Done: 1
|
|
|
|
Error in argument %d, char %d: no argument for option %s
|
|
Usage: %s [options] [-f] <file> [--] [args...]
|
|
Done: 1
|
|
|
|
PHP %s
|
|
Done: 0
|