Review main Merged

71386[TASK] Remove superflous method initializeBasicErrorReporting

Anja Leichsenring CR +2 V +2 Easy +1 −21 updated 10/02/21, 00:33

Commit message

The function used to be called way earlier than initializing
final error handling, but ended up being called only one step before.
This makes the function useless and therefor subject to removal.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Christian Kuhn +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1214

  1. Anja Leichsenring uploaded patch set 1 09/30/21, 15:19

  2. core-ci voted on patch set 1 V +1 09/30/21, 15:36 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17356

  3. Benjamin Franzke voted on patch set 1 CR +1 09/30/21, 15:49

  4. Christian Kuhn voted on patch set 1 V +1 CR +1 09/30/21, 15:51

  5. Benjamin Franzke commented on patch set 1 V -1 CR 0 09/30/21, 16:18

    Hm.. causes PHP notices to be printed to console with $GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] = 1. Hasn't been the case before.
  6. Benjamin Franzke commented on patch set 1 09/30/21, 16:24

    Reply

    To reproduce: echo '$bar = []; $foo = $bar["test"];' >> typo3/sysext/core/ext_localconf.php ddev exec bin/typo3 cache:warmup Outputs: PHP Notice: Undefined index: test in /var/www/html/typo3/sysext/core/ext_localconf.php on line 103 Notice: Undefined index: test in /var/www/html/typo3/sysext/core/ext_localconf.php on line 103 Without this patch: (Empty output)
  7. Christian Kuhn commented on patch set 1 V 0 CR 0 09/30/21, 16:59

    will analyze.
  8. Christian Kuhn uploaded patch set 2 09/30/21, 17:59

  9. Christian Kuhn commented on patch set 1 09/30/21, 18:05

    Reply

    that's because our errorHandler did not register for e_notice, yet, so notices then bubbled up to default php error handler, where then error_reporting kicked in to suppress the notice. new patch set now registers our errorHandler for e_all (always) and applies the check if it should do something in handleError() as before, and then returns "do not bubble up error". this is of course much better than before, since now, errors never bubble up to default php error handler and all errors are handled in our error handler. this is especially useful to mitigate a nasty difference in error handling logic between php 7.4 and 8.0, where 8.0 turns so many notices into warnings now.
  10. core-ci voted on patch set 2 V +1 09/30/21, 18:11 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17362

  11. Christian Kuhn commented on patch set 2 V +1 CR +1 10/01/21, 10:20

    i'm still not sure if we should still do that in v11, or wait with that patch until v12 ... if 'wait for v12 to be sure', we could change the patch to a @todo in v11 or similar. otoh, it would be good to sort this out in v11 since testing-framework kinda depends on this change and it becomes even more nasty in TF without that change. TF functional tests currently suppress notices and warnings in many areas, which is why functional tests did not find as many php 8 issues as they should have ... so ... it would be great to have that patch in v11 since it helps us with php 8 stabilization in the end ... question is only, if it's risky to do this patch in v11 at this point. my personal risk assessment says it should be fine, but i'm looking for further input.
  12. Benjamin Franzke commented on patch set 2 CR -1 10/01/21, 10:33

    I think we need to be very strict with out error handler then. I'd like to drop writeLog() there, in order to avoid using doctrine.. Issue is: I'm not sure when ErrorHandler->writeLog ist actually triggered, since most things are likely handled by the ExceptionHandler anyway (due to Throwable).
  13. Benjamin Franzke commented on patch set 2 V +2 CR +2 10/02/21, 00:33

    Reply

    Ok, I've now checked ErrorHandler->writeLog and it is triggered for warnings and notices if E_WARNING or E_NOTICE is included in both: GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors'] and GLOBALS['TYPO3_CONF_VARS']['SYS']['belogErrorReporting']. So there is a usecase and we cannot just drop it. But: I tested ErrorHandler->writeLog() and it is notice free, therefore I'm now fine with this change and confident that this is safe.
  14. Benjamin Franzke merged patch set 3 10/02/21, 00:33