Several improvements on how PHP errors are managed.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 1 Nov 2010 14:54:40 +0000 (15:54 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 1 Nov 2010 14:54:40 +0000 (15:54 +0100)
commitc67e49ea00f6d2975b8100ab294790c73dcb0aaa
tree3b573a583348416a3972fa780fcb926982cb3251
parentc426670b7737f934c347fbbe2749b71d1c227f02
Several improvements on how PHP errors are managed.

Use PlBacktrace to handle PHP error instead of $GLOBAL['pl_errors']. When
output is in json add a special key with the traces. When site is in debug
mode, errors are automatically dumped by PlBacktrace. When site is in
production mode, use the legacy pl_print_errors to print the errors at the
bottom on the page.

This commit also introduce a new solution to build json handlers: if the
handler return PL_JSON, then the site will produce json from the variables
previously assigned vi jsonAssign.

Note:  Don't use jsonDisplay() for the new json output because
jsonDisplay() output contains user-controlled content (I mean, content
passed by the user through Post, Get or Cookie) and this is not a good
idea: the site should never output something it does not fully control.

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/platal.php
classes/plpage.php
include/platal.inc.php