aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-12-04 18:52:27 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2012-12-04 18:52:27 -0500
commitfb261e19ffc3bf19477510fa3877a8d9ea251655 (patch)
tree75b5920481712a4502a5344073c089d28c5fc5b0
parent8ea52b56197cc9a234d6b0ce3ddd10820feb6dd1 (diff)
downloadforums-fb261e19ffc3bf19477510fa3877a8d9ea251655.tar
forums-fb261e19ffc3bf19477510fa3877a8d9ea251655.tar.gz
forums-fb261e19ffc3bf19477510fa3877a8d9ea251655.tar.bz2
forums-fb261e19ffc3bf19477510fa3877a8d9ea251655.tar.xz
forums-fb261e19ffc3bf19477510fa3877a8d9ea251655.zip
[ticket/10716] Collect standard error from executed php process.
php executes everything via a shell. The standard error of this top level shell is not captured by exec/shell_exec/popen/etc. and there is no way to capture it. proc_open might work but it is a nightmare to use and without multiplexing reads from standard error and standard output it can deadlock. Thus the solution in this commit. Put the command into a subshell and redirect standard error to standard output for the subshell. PHPBB3-10716
-rw-r--r--tests/lint_test.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/lint_test.php b/tests/lint_test.php
index d73ab7fedd..905067072d 100644
--- a/tests/lint_test.php
+++ b/tests/lint_test.php
@@ -15,9 +15,10 @@ class phpbb_lint_test extends phpbb_test_case
{
$output = array();
$status = 1;
- exec('php -v', $output, $status);
+ exec('(php -v) 2>&1', $output, $status);
if ($status)
{
+ $output = implode("\n", $output);
self::markTestSkipped("php is not in PATH or broken: $output");
}
@@ -61,7 +62,7 @@ class phpbb_lint_test extends phpbb_test_case
else if (substr($filename, strlen($filename)-4) == '.php')
{
// assume php binary is called php and it is in PATH
- $cmd = 'php -l ' . escapeshellarg($path);
+ $cmd = '(php -l ' . escapeshellarg($path) . ') 2>&1';
$output = array();
$status = 1;
exec($cmd, $output, $status);