From a0da2408e7cb0054da5d766bffa91f23d7beaec9 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Tue, 3 Apr 2012 23:18:33 -0400 Subject: [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 --- git-tools/hooks/pre-commit | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'git-tools') 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 -- cgit v1.2.1