|author||Oleg Pudeyev <firstname.lastname@example.org>||2012-04-04 00:27:06 -0400|
|committer||Oleg Pudeyev <email@example.com>||2012-04-04 00:27:06 -0400|
|parent||[ticket/10760] Catch both versions of parse error output in php. (diff)|
[ticket/10760] PHP is great. This commit is the proof.
1 files changed, 24 insertions, 0 deletions
diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit
index bb667bf8ff..9e78edd90d 100755
@@ -101,6 +101,30 @@ then
# if both are turned on php dumps the parse error twice.
# therefore here we try to grep for one version and
# if that yields no results grep for the other version.
+ # other fun php facts:
+ # 1. in cli, display_errors and log_errors have different
+ # destinations by default. display_errors prints to
+ # standard output and log_errors prints to standard error.
+ # whether these destinations make sense is left
+ # as an exercise for the reader.
+ # 2. as mentioned above, with all output turned on
+ # php will print parse errors twice, one time on stdout
+ # and one time on stderr.
+ # 2. it is possible to set both display_errors and log_errors
+ # to off. if this is done php will print the text
+ # "Errors parsing <file>" but will not say what
+ # the errors are. useful behavior, this.
+ # 3. on my system display_errors defaults to on and
+ # log_errors defaults to off, therefore providing
+ # by default one copy of messages. your mileage may vary.
+ # 4. by setting display_errors=stderr and log_errors=on,
+ # both sets of messages will be printed on stderr.
+ # 5. php-cgi binary, given display_errors=stderr and
+ # log_errors=on, still prints both sets of messages
+ # on stderr, but formats one set as an html fragment.
+ # 6. your entry here? ;)
$echo_e "$errors" | grep "^Parse error:"
if [ $? -ne 0 ]