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>