Review main Merged

70868[BUGFIX] Fix garbled output due to deprecated DB writes

Benjamin Franzke CR +2 V +2 Easy +23 −0 updated 09/30/21, 15:27

Commit message

Happens in case a PHP warning occurs during ext_localconf or
ext_tables loading (early boot). as ConnectionPool usage is
deprecated for this case since #94979.

The deprecation message would then be printed to the
output, as it occured inside the error handler, and is
therefore not handled.
This destroys json output during installtool upgrades
and command line outputs. Therefore the deprecation output
must be circumvented by avoiding the database connection.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Markus Klein +1
    • Nikita Hovratov +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Markus Klein +1
    • Nikita Hovratov +1
    • core-ci +1 CI

Issues 2

Files 2

Review log 2127

Show 12 earlier messages
  1. Benjamin Franzke uploaded patch set 1 09/02/21, 14:38

  2. core-ci voted on patch set 1 V +1 09/02/21, 14:59 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16089

  1. Benjamin Franzke uploaded patch set 2 09/06/21, 15:59

  2. core-ci voted on patch set 2 V +1 09/06/21, 16:20 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16337

  3. Helmut Hummel commented on patch set 2 CR -1 09/06/21, 17:38

    ErrorHandler.php:230

    Why always converting to info. This likely hides the message for many users. I'd rather either keep the original severity or log twice

    ErrorHandler.php:232

    first one should be $logMessage
  4. Markus Klein commented on patch set 2 09/06/21, 18:13

    I fully agree with Helmut
  5. Benjamin Franzke uploaded patch set 3 09/07/21, 04:09

  6. Benjamin Franzke commented on patch set 3 09/07/21, 04:09

    ErrorHandler.php:230 Reply

    Good point, I wouldn't like to hide the message by severity in general as well. I "switched" to info in this case, as the message is logged via $this->logger with the original severity in https://review.typo3.org/c/Packages/TYPO3.CMS/+/70868/2/typo3/sysext/core/Classes/Error/ErrorHandler.php#170 in before this attempt to log to the databse. That means, if the user inspects the (file) log it will see the error from line 170 anyway. Now, given that, why did I add this $this->logger->info() call at all? I basically only wanted to inform a user that tries to debug why the error log entry for the PHP WARNING wasn't visible in the database. Maybe I should have eben used $this->logger->debug() for that usecase. …will swich to debug() and add a comment to the code.

    ErrorHandler.php:232 Reply

    Done
  7. core-ci voted on patch set 3 V +1 09/07/21, 04:28 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16364

  8. Benjamin Franzke commented on patch set 3 09/16/21, 21:36

    ErrorHandler.php:230 Reply

    Done
  9. Benjamin Franzke uploaded patch set 4 09/16/21, 23:13

  10. Benjamin Franzke commented on patch set 4 09/16/21, 23:16

    Hey Helmut, I just noticed this deprecation log (thrown inside the error handler and as such not handled) may also destroy output of json-responses in installtool. For example in the upgradeWizardsBlockingDatabaseExecute action: http://t3core.localhost/typo3/install.php?install%5Bcontroller%5D=upgrade&install%5Baction%5D=upgradeWizardsBlockingDatabaseExecute&referrer-refresh=1631833893 <br /> <b>Deprecated</b>: TYPO3\CMS\Core\Database\ConnectionPool can not be injected/instantiated during ext_localconf.php/TCA/ext_tables.php loading. Use lazy loading instead. in <b>/home/ben/src/TYPO3.CMS/typo3/sysext/core/Classes/ServiceProvider.php</b> on line <b>142</b><br /> {"success":true,"status":[{"severity":0,"title":"Added missing database fields and tables","message":"","storeInSession":false}]} We should really fix this…
  11. Benjamin Franzke updated the commit message in patch set 5 09/16/21, 23:20

  12. core-ci voted on patch set 5 V +1 09/16/21, 23:34 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16843

  13. Markus Klein commented on patch set 5 09/17/21, 06:13

    ErrorHandler.php:233

    One thing that came to my mind: What if someone configured a DB writer for this logger?
  14. Benjamin Franzke uploaded patch set 6 09/17/21, 06:44

  15. Benjamin Franzke commented on patch set 6 09/17/21, 06:44

    ErrorHandler.php:233 Reply

    Good point, that results into the same issue, yes (tested with a DatabaseWriter on the "root" level) Fixed by adding the same condition to the DatabaseWriter.
  16. core-ci voted on patch set 6 V +1 09/17/21, 06:55 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16852

  17. Markus Klein voted on patch set 6 CR +1 09/17/21, 07:12

  18. Benni Mack voted on patch set 6 CR +1 09/27/21, 08:50

  19. Benni Mack voted on patch set 6 V +1 09/28/21, 14:26

  20. Nikita Hovratov uploaded patch set 7 09/30/21, 14:01

  21. Nikita Hovratov voted on patch set 7 V +1 CR +1 09/30/21, 14:16

  22. core-ci voted on patch set 7 V +1 09/30/21, 14:17 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17341

  23. Markus Klein voted on patch set 7 V +1 CR +1 09/30/21, 15:22

  24. Christian Kuhn voted on patch set 7 V +2 CR +2 09/30/21, 15:26

  25. Christian Kuhn merged patch set 8 09/30/21, 15:27