aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-04-03 23:18:33 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2012-04-03 23:18:33 -0400
commita0da2408e7cb0054da5d766bffa91f23d7beaec9 (patch)
tree3db72d326b9b24e764c22a2d9d916211f2af5d40 /git-tools/hooks
parent[ticket/10760] Quote PHP_BIN when using it. (diff)
downloadphpbb-a0da2408e7cb0054da5d766bffa91f23d7beaec9.tar.gz
phpbb-a0da2408e7cb0054da5d766bffa91f23d7beaec9.tar.bz2
phpbb-a0da2408e7cb0054da5d766bffa91f23d7beaec9.zip
[ticket/10760] Account for display_errors=stderr in pre-commit hook.
With that php.ini value set errors are printed to stderr, therefore by redirecting stderr to /dev/null we also throw out the errors. Instead merge stderr into stdout. PHPBB3-10760
Diffstat (limited to 'git-tools/hooks')
-rwxr-xr-xgit-tools/hooks/pre-commit8
1 files changed, 7 insertions, 1 deletions
diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit
index 5be33fb9a1..a0c2b6b247 100755
--- a/git-tools/hooks/pre-commit
+++ b/git-tools/hooks/pre-commit
@@ -73,7 +73,13 @@ do
# check the staged file content for syntax errors
# using php -l (lint)
- result=$(git cat-file -p $sha | "$PHP_BIN" -l 2>/dev/null)
+ # note: if display_errors=stderr in php.ini,
+ # parse errors are printed on stderr; otherwise
+ # they are printed on stdout.
+ # we filter everything other than parse errors
+ # with a grep below, therefore it should be safe
+ # to combine stdout and stderr in all circumstances
+ result=$(git cat-file -p $sha | "$PHP_BIN" -l 2>&1)
if [ $? -ne 0 ]
then
error=1