Project

General

Profile

Actions

Bug #61213

closed

[SYS][displayErrors] = 2 allows code be executed even after Fatal Error

Added by Viktor Livakivskyi over 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2014-08-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.1
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

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?


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #61235: Improve and simplify the description of TYPO3 error handling options, also cleanup the codeClosedMarkus Klein2014-08-27

Actions
Actions

Also available in: Atom PDF