raccoondepot / error_log

TYPO3 Advanced Error Log
GNU General Public License v2.0
13 stars 3 forks source link

de-installation failed / Fatal error: Uncaught Error: Class "RD\ErrorLog\Handler\ErrorHandler" not found #23

Open medarob opened 1 month ago

medarob commented 1 month ago

I installed the extension but got deprecation warnings in the FE so I wanted to deinstall the extension again, to see if the warning will be gone.

During deinstallation, an error occured and this breaks the instaltion completely.

TYPO3 11.5.39

bash-4.2$ composer remove raccoondepot/error-log
./composer.json has been updated
Running composer update raccoondepot/error-log
Gathering patches from patch file.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 0 updates, 5 removals
  - Removing erusev/parsedown (1.7.4)
  - Removing raccoondepot/error-log (11.5.4)
  - Removing slack-php/slack-block-kit (1.0.0)
  - Removing symfony/http-client (v5.4.44)
  - Removing symfony/http-client-contracts (v2.5.3)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 0 updates, 5 removals
  - Removing symfony/http-client-contracts (v2.5.3)
  - Removing symfony/http-client (v5.4.44)
  - Removing slack-php/slack-block-kit (1.0.0)
  - Removing raccoondepot/error-log (11.5.4)
  - Removing erusev/parsedown (1.7.4)
Generating autoload files
Generating class alias map file

In FailedSubProcessCommandException.php line 55:

  Executing command "/usr/bin/php -d error_reporting=0 -d display_errors=0 /var/www/typo3_intranet-dev2/vendor/helhum/typo3-console/typo3cms install:fixfolderstructure" failed (exit code: "255")  

remove [--dev] [--dry-run] [--no-progress] [--no-update] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-all-dependencies] [--no-update-with-dependencies] [-m|--minimal-changes] [--unused] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>...]

Now the following is shown in the FE:

Fatal error: Uncaught Error: Class "RD\ErrorLog\Handler\ErrorHandler" not found in /var/www/typo3_intranet-dev2/public/typo3/sysext/core/Classes/Utility/GeneralUtility.php:3215
Stack trace:
#0 /var/www/typo3_intranet-dev2/public/typo3/sysext/core/Classes/Core/Bootstrap.php(428): TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('RD\\ErrorLog\\Han...', 30464)
#1 /var/www/typo3_intranet-dev2/public/typo3/sysext/core/Classes/Core/Bootstrap.php(104): TYPO3\CMS\Core\Core\Bootstrap::initializeErrorHandling()
#2 /var/www/typo3_intranet-dev2/public/typo3/index.php(20): TYPO3\CMS\Core\Core\Bootstrap::init(Object(Composer\Autoload\ClassLoader))
#3 /var/www/typo3_intranet-dev2/public/typo3/index.php(21): {closure}()
#4 {main} thrown in /var/www/typo3_intranet-dev2/public/typo3/sysext/core/Classes/Utility/GeneralUtility.php on line 3215

After manually removing the following entries from the LocalConfiguration.php the BE and FE works again

        //'debugExceptionHandler' => 'RD\\ErrorLog\\Handler\\DebugExceptionHandler',
        'devIPmask' => '',
        'displayErrors' => 0,
        //'errorHandler' => 'RD\\ErrorLog\\Handler\\ErrorHandler',
        //'exceptionalErrors' => 4096,
        //'productionExceptionHandler' => 'RD\\ErrorLog\\Handler\\ProductionExceptionHandler',
Voronov commented 1 month ago

Yes, we are aware of this problem after running composer remove. Unfortunately, we haven't found a way to modify our handlers during the removal process. @medarob

mbrodala commented 1 month ago

You could hard-register them in your ext_localconf.php if an extension setting for this is enabled, e.g. "Automatically register error handlers". If not enabled, people need to manually register them instead, then hopefully being aware that they also manually need to remove them again on package removal.

medarob commented 1 month ago

answer from @helhum in Slack: https://typo3.slack.com/archives/C028J3N83/p1729178993885199?thread_ts=1729147309.107199&cid=C028J3N83

error and exception handler must be available early in the bootstrap. registering them in ext_localconf.php will be ineffective and will not work any more (it worked in older versions but the code was very messy to support that)

it is imho a design flaw in typo3, that exchanging those is allowed. instead it should only be possible to provide listeners for errors and renderer for exceptions. the handler themselves should/ must be generic hand hard coded