[BUGFIX] ErrorHandler: Stop execution if E_RECOVERABLE_ERROR occurs 65/32465/4
authorMarkus Klein <klein.t3@reelworx.at>
Wed, 27 Aug 2014 22:30:10 +0000 (00:30 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 23 Oct 2014 20:34:56 +0000 (22:34 +0200)
Ensure the ErrorHandler stops script execution if an error occurs.

Resolves: #61213
Releases: master, 6.2, 6.1
Change-Id: I0324a571b494576db1d314d8af0a86273e3205d3
Reviewed-on: http://review.typo3.org/32465
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/Error/ErrorHandler.php

index accd4e2..5fe0e98 100644 (file)
@@ -138,24 +138,29 @@ class ErrorHandler implements ErrorHandlerInterface {
                                } catch (\Exception $e) {
                                }
                        }
-                       // Add error message to the flashmessageQueue
-                       if (defined('TYPO3_ERRORHANDLER_MODE') && TYPO3_ERRORHANDLER_MODE == 'debug') {
-                               /** @var $flashMessage \TYPO3\CMS\Core\Messaging\FlashMessage */
-                               $flashMessage = GeneralUtility::makeInstance(
-                                       'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
-                                       $message,
-                                       'PHP ' . $errorLevels[$errorLevel],
-                                       $severity
-                               );
-                               /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
-                               $flashMessageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
-                               /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
-                               $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
-                               $defaultFlashMessageQueue->enqueue($flashMessage);
+                       if ($severity === 2) {
+                               // Let the internal handler continue. This will stop the script
+                               return FALSE;
+                       } else {
+                               // Add error message to the flashmessageQueue
+                               if (defined('TYPO3_ERRORHANDLER_MODE') && TYPO3_ERRORHANDLER_MODE == 'debug') {
+                                       /** @var $flashMessage \TYPO3\CMS\Core\Messaging\FlashMessage */
+                                       $flashMessage = GeneralUtility::makeInstance(
+                                               'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
+                                               $message,
+                                               'PHP ' . $errorLevels[$errorLevel],
+                                               $severity
+                                       );
+                                       /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
+                                       $flashMessageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
+                                       /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
+                                       $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
+                                       $defaultFlashMessageQueue->enqueue($flashMessage);
+                               }
+                               // Don't execute PHP internal error handler
+                               return TRUE;
                        }
                }
-               // Don't execute PHP internal error handler
-               return TRUE;
        }
 
        /**