Task #87281
closedErrorhandler handles errors without verifying the configured error level
100%
Description
I track errors with Sentry (getsentry.io) and the extension https://extensions.typo3.org/extension/sentry_client/ which uses https://github.com/getsentry/sentry-php
Its error handler is registered with E_ALL to get every error. That is nice, because Exceptions are enriched with additional informations.
When an error occurs it does its own handling and then forwards the error to \TYPO3\CMS\Core\Error\ErrorHandler. This is nice, because TYPO3 should do it normal error handling (Show error page, flashmessages, logging, etc.)
Currently there is no easy way to get the error level of an earlier instantiated error handler (See https://bugs.php.net/bug.php?id=54033)
So what Sentrys error handler does it to forward every error (even E_NOTICE) to \TYPO3\CMS\Core\Error\ErrorHandler and there every error is handled (Logging + Flashmessages).
A standard page in TYPO3
page = PAGE page.10 = TEXT page.10.value = Hello World
fires a lot of PHP notices resulting in 30ms+ for the code in \TYPO3\CMS\Core\Error\ErrorHandler::handleError which is not needed.
The shortest way to correct it is to check the configured error level in \TYPO3\CMS\Core\Error\ErrorHandler before handling an error