[TYPO3-english] Mystics of [SYS][displayErrors] = 2

Viktor Livakivskyi invisible.kinder at gmail.com
Fri Aug 22 12:00:12 CEST 2014


Recently I've found strange behaviour of displayErrors setting in TYPO3.
What I though is, that when it is set to '2', then behaviour of error habdling is same, as with '-1', but no override of disaply_errors PHP settings happens.

But in fact it is different.
First of all, display_errors *is* overriden with any setting, except '-1' (you can find actual code in Bootstrap->configureExceptionHandling()), while descrition tells opposite.
Next it turns exceptionalErros mask to 0, if devIpMask doesn't match, meaning that no errors are treated as exceptional anymore.

So, the result of such actions can be seen in following example:
Let's say, we have such code:
class MyObjectManager {
..
public function processObject(MyObject $obj) {
$this->user->addRelation($obj);
$this->persistanceManager->persistAll();
}

}

You see, that processObject() method expects object of type MyObject and this will result in PHP Catchable Fatal Error to be fired if e.g. NULL is passed. This really happens and ErrorHandler processes this error by handleError() method.
Inside that method there is a check for $this->exceptionalErrors, which is '0' if devIpMask doesn't match, and this prevents from throwing an Exception. The error only gets logged and... code continues it's execution.

So, in the case above it will lead to 'user' object getting relation to NULL and persisting of this realtion.

Setting displayErrors to -1 prevents this behavior and exception is thrown, which results in breaking code execution.

Now I wonder: is it desired behavior of [SYS][displayErrors] = 2 or is it bug?

TYPO3 6.1.10


More information about the TYPO3-english mailing list