/
[system log] Improve sub-handler triggering in System Log [5.2.1]

[system log] Improve sub-handler triggering in System Log [5.2.1]

To enable error/exception logging the System Log is replacing default error/exception handlers with it's own. This is no big deal unless Debug Mode is enabled. In that case Debugger adds own error/exception handlers even before System Log is able to initialize. Luckily such case is already handled by System Log, which calls any former error/exception handlers after it's own.

What isn't right about this is how it calls them. Currently it's done like this:

if ( is_array($handler) ) {
	$object =& $handler[0];
	$method = $handler[1];
	$res = $object->$method($errno, $errstr, $errfile, $errline, $errcontext);
}
else {
	$res = $handler($errno, $errstr, $errfile, $errline, $errcontext);
}

Such invocation method only supports error/exception handlers that are defined in 2 forms:

  • array, where 1st element is object and 2nd element is method name
  • string, that contains method name

In real life there are plenty of ways how we can define error/exception handler.

Solution

Use call_user_func function to invoke previously set error/exception handlers.

Related Tasks

INP-1402 - Getting issue details... STATUS