Review main Merged

88361[BUGFIX] Handle EXT:scheduler task deserialisation more gracefully

Garvin Hicking CR +2 V +2 Easy +25 −1 updated 02/27/25, 09:46

Commit message

In case a scheduler task cannot be deserialized (for example,
tasks of extensions where an extension upgrade restructured central
object classes), also PHP TypeErrors are now caught and forwarded
with the specific `InvalidTaskException`, including the previous
exception/throwable.

A test is added for this scenario, with a manipulated serialized
string that would assign a mismatching type (string instead of array)
in the property `any`.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Georg Ringer +1
    • Lina Wolf +1
    • Stefan Bürk +1
    • Christian Kuhn +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Georg Ringer +1
    • Lina Wolf +1
    • Stefan Bürk +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 2327

Show 12 earlier messages
  1. Garvin Hicking uploaded patch set 1 02/25/25, 20:16

  2. core-ci voted on patch set 1 V -1 02/25/25, 20:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74703

  1. Garvin Hicking uploaded patch set 2 V -1 02/25/25, 20:31

  2. core-ci voted on patch set 2 V +1 02/25/25, 20:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74704

  3. Georg Ringer voted on patch set 2 CR +1 V +1 02/25/25, 20:58

  4. Lina Wolf commented on patch set 2 CR -1 V -1 02/26/25, 06:44

    This solution would not have solved my problem. A type error is an error, not an exception. I would suggest to catch `catch (\Throwable $e)` or explicitly catch also Type Errors.
  5. Lina Wolf commented on patch set 2 02/26/25, 06:46

    Reply

    Thanks a lot for seeing into this problem. However this solution would not have solved my problem. A type error is an error, not an exception. I would suggest to catch `catch (\Throwable $e)` or explicitly catch also Type Errors.
  6. Garvin Hicking uploaded patch set 3 CR +1 V +1 02/26/25, 09:05

  7. Garvin Hicking commented on patch set 3 02/26/25, 09:06

    Reply

    Thanks a lot for this, you are right of course, good you paid attention to this. I've adapted the code and now added a test case for this, what do you think?
  8. core-ci voted on patch set 3 V +1 02/26/25, 09:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74735

  9. Lina Wolf commented on patch set 3 CR +1 V +1 02/26/25, 09:22

    This patch works in my TYPO3 13.4 real project with multiple old scheduler tasks. Code looks good to me
  10. Lina Wolf commented on patch set 3 02/26/25, 09:23

    Reply

    Done
  11. Georg Ringer voted on patch set 3 CR +1 V +1 02/26/25, 10:00

  12. Mathias Brodala commented on patch set 3 CR -1 02/26/25, 10:47

    TaskSerializer.php:56

    It is good practice to forward the original exception here.
  13. Garvin Hicking commented on patch set 3 02/26/25, 11:21

    TaskSerializer.php:56 Reply

    how, do you have an example of this practice?
  14. Lina Wolf commented on patch set 3 02/26/25, 11:21

    TaskSerializer.php:56 Reply

    If you are throwing the original exception here the whole backend module will be blocked by the exception and the backend module can then not be used to delete the outdated task. Therefore I would argue that the de-serialization of a possibly outdated task is a rare exception to the general best practice.
  15. Mathias Brodala commented on patch set 3 02/26/25, 11:25

    TaskSerializer.php:56 Reply

    Just pass the caught exception as 3rd argument to any exception: throw new InvalidTaskException('The serialized task is corrupted: ' . $e->getMessage(), 1740514197, $e); This way an exception trace, if produced somewhere, will be complete.
  16. Garvin Hicking uploaded patch set 4 CR +1 V +1 02/26/25, 19:11

    Adjust to also include previous exception
  17. Garvin Hicking commented on patch set 4 02/26/25, 19:11

    TaskSerializer.php:56 Reply

    Thanks. Sounds useful to me, included it.
  18. core-ci voted on patch set 4 V +1 02/26/25, 19:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74787

  19. Christian Kuhn voted on patch set 4 CR +1 V +1 02/27/25, 08:14

  20. Lina Wolf voted on patch set 4 CR +1 V +1 02/27/25, 08:26

  21. Stefan Bürk voted on patch set 4 CR +1 V +1 02/27/25, 08:51

  22. Georg Ringer voted on patch set 4 CR +1 V +1 02/27/25, 09:10

  23. Andreas Kienast voted on patch set 4 CR +1 02/27/25, 09:12

  24. Garvin Hicking voted on patch set 4 CR +2 V +2 02/27/25, 09:13

  25. Garvin Hicking merged patch set 5 02/27/25, 09:46