Review main Abandoned

64182[BUGFIX] Fix type error in log upgrade wizard

Georg Großberger CR 0 V 0 Easy +14 −8 updated 10/09/20, 13:34

Commit message

During the update, the value of the field log_data is
unserialized. The expected value is an array, but it was
never validated. If the field contains an invalid value,
unserialize() returns a boolean false.

Now the result is type casted to an array to ensure the
correct type.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 1

Review log 3541

Show 1316 earlier messages
  1. Georg Großberger uploaded patch set 1 04/15/20, 11:44

  2. TYPO3com voted on patch set 1 V +1 04/15/20, 11:59 Completed build in 14m 33s on Wed, 15 Apr, 11:59 AM Test Summary: 73523 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-2572

  3. Oliver Klee voted on patch set 1 CR +1 04/15/20, 12:02

  4. Benni Mack voted on patch set 1 CR +1 04/15/20, 12:26

  5. Alexander Schnitzler commented on patch set 1 CR -1 04/15/20, 12:31

    SeparateSysHistoryFromSysLogUpdate.php:174 Unresolved

    Not sure if we want to end up with a possible array like this: array(0 => false); See https://3v4l.org/GCFpa I'd like to have this instead of the general array type casting > $logData = is_array($logData) ? $logData : [];
  6. Jonas Eberle uploaded patch set 2 04/18/20, 13:27

  7. Oliver Hader commented on patch set 2 CR -1 04/18/20, 13:55

    SeparateSysHistoryFromSysLogUpdate.php:174

    In case `$row['log_data']` is null, it will issue a warning... Probably you want to have `unserialize($row['log_data'] ?? '', ['allowed_classes' => false]);`
  8. TYPO3com voted on patch set 2 V -1 04/18/20, 13:56 Completed build in 24m 15s on Sat, 18 Apr, 01:56 PM Test Summary: 36 of 74111 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-2804

  9. Alexander Schnitzler commented on patch set 2 04/18/20, 14:15

    SeparateSysHistoryFromSysLogUpdate.php:174 Reply

    Or ?? 'a:0:{}' like further down in the patch.
  10. Jonas Eberle commented on patch set 2 04/18/20, 15:10

    SeparateSysHistoryFromSysLogUpdate.php:174 Reply

    unserialize() AFAIK only returns null for "N;". And anyways is_array(null) === false. Errors return false and trigger E_NOTICE https://www.php.net/manual/en/function.unserialize.php. PHP docs are shite though because they do not mention the possible null return value... Funily, unserialize(null) does not trigger an E_NOTICE but still returns false. I avoided the previous `?? 'a:0:{}'` because it was smelly IMHO. Please change as you like. I just wanted to push that patch forward to shorten the list https://forge.typo3.org/projects/typo3cms-core/issues?utf8=%E2%9C%93&set_filter=1&f%5B%5D=status_id&op%5Bstatus_id%5D=%3D&v%5Bstatus_id%5D%5B%5D=11&v%5Bstatus_id%5D%5B%5D=8&f%5B%5D=fixed_version_id&op%5Bfixed_version_id%5D=%3D&v%5Bfixed_version_id%5D%5B%5D=3574&f%5B%5D=category_id&op%5Bcategory_id%5D=%21&v%5Bcategory_id%5D%5B%5D=1684&v%5Bcategory_id%5D%5B%5D=1107&f%5B%5D=&c%5B%5D=tracker&c%5B%5D=status&c%5B%5D=priority&c%5B%5D=subject&c%5B%5D=assigned_to&c%5B%5D=category&c%5B%5D=fixed_version&c%5B%5D=cf_7&group_by=&t%5B%5D=
  11. Alexander Schnitzler commented on patch set 2 04/18/20, 15:21

    SeparateSysHistoryFromSysLogUpdate.php:174 Reply

    It's less about what is put into unserialize, it's more that there will be an error triggered if $row['log_data'] is not set and we access it. That's why we use ?? ''. btw: I ran some tests with blackfire and unserializing 'a:0:{}' is slower than ''. I guess it's because the inner c call returns early. With 100.000 runs, it was 20% slower and consumed 50% more cpu time. Of course, that's a stupid comparison but still the one is faster than the other.
  12. Alexander Schnitzler uploaded patch set 3 04/18/20, 15:32

  13. Oliver Klee voted on patch set 3 CR +1 04/18/20, 15:35

  14. TYPO3com voted on patch set 3 V +1 04/18/20, 15:45 Completed build in 12m 34s on Sat, 18 Apr, 03:44 PM Test Summary: 73627 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-2812

  15. Jonas Eberle commented on patch set 3 CR +1 04/18/20, 17:32

    SeparateSysHistoryFromSysLogUpdate.php:174 Reply

    Done
  16. Josef Glatz voted on patch set 3 CR +1 04/21/20, 03:49

  1. Josef Glatz voted on patch set 3 V +1 04/21/20, 05:46

  2. Guido Schmechel voted on patch set 3 CR +1 04/21/20, 06:46

  3. Wouter Wolters voted on patch set 3 CR +1 04/21/20, 07:00

  4. Benni Mack commented on patch set 3 04/21/20, 10:31

    SeparateSysHistoryFromSysLogUpdate.php:183

    there might be an issue here as well?
  5. Georg Großberger uploaded patch set 4 04/23/20, 08:18

  6. Georg Großberger commented on patch set 4 04/23/20, 08:19

    SeparateSysHistoryFromSysLogUpdate.php:183 Reply

    Not during the import, later possibly. Pushed a new patchset fix this too.
  7. TYPO3com voted on patch set 4 V -1 04/23/20, 08:29 Completed build in 11m 16s on Thu, 23 Apr, 08:29 AM Test Summary: 73657 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-2990

  8. Georg Großberger uploaded patch set 5 04/23/20, 08:55

  9. TYPO3com voted on patch set 5 V +1 04/23/20, 09:06 Completed build in 11m 15s on Thu, 23 Apr, 09:06 AM Test Summary: 73657 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-2991

  10. Oliver Klee commented on patch set 5 CR -1 04/23/20, 09:08

    SeparateSysHistoryFromSysLogUpdate.php:393

    Please let's use type declarations instead.

    SeparateSysHistoryFromSysLogUpdate.php:398

    Please let's not overwrite the variable here. Instead, please let's use another variable or directly return the value.
  11. Alexander Schnitzler commented on patch set 5 04/23/20, 10:54

    SeparateSysHistoryFromSysLogUpdate.php:398 Reply

    I am in favor of direct return.
  12. Georg Großberger uploaded patch set 6 04/24/20, 09:16

  13. Georg Großberger commented on patch set 6 04/24/20, 09:17

    SeparateSysHistoryFromSysLogUpdate.php:393 Reply

    Parameter $serialized cannot be typed. At least not until PHP 8.0. Added a return type though.

    SeparateSysHistoryFromSysLogUpdate.php:398 Reply

    Done
  14. Oliver Klee commented on patch set 6 04/24/20, 09:19

    SeparateSysHistoryFromSysLogUpdate.php:393 Reply

    Can't it be "?string" (i.e., a nullable string)?
  15. Georg Großberger commented on patch set 6 04/24/20, 15:20

    SeparateSysHistoryFromSysLogUpdate.php:393 Reply

    Unfortunatly not, can also be a boolean "false".
  16. Oliver Klee commented on patch set 6 04/24/20, 15:29

    SeparateSysHistoryFromSysLogUpdate.php:393 Reply

    Then the @param annotation is incorrect and needs to be fixed.
  17. Oliver Klee commented on patch set 6 CR -1 04/25/20, 12:07

    SeparateSysHistoryFromSysLogUpdate.php:392

    The type annotation still needs to be fixed.
  18. Jonas Eberle wrote 04/26/20, 11:58

    Removed reviewer Jonas Eberle.
  19. Georg Großberger uploaded patch set 7 04/29/20, 11:21

  20. Georg Großberger commented on patch set 7 04/29/20, 11:23

    SeparateSysHistoryFromSysLogUpdate.php:392 Reply

    Thanks for pointing that out. Did it a bit different now, please take a look at patchset 7.
  21. TYPO3com voted on patch set 7 V +1 04/29/20, 11:32 Completed build in 11m 19s on Wed, 29 Apr, 11:32 AM Test Summary: 73663 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3106

  22. Oliver Klee voted on patch set 7 CR +1 04/29/20, 12:00

  23. Benni Mack updated the commit message in patch set 8 05/25/20, 18:48

  24. Daniel Goerz commented on patch set 8 10/09/20, 13:34

    Please continue in the 10.4 branch as this Upgrade Wizard does not exist in master anymore https://review.typo3.org/c/Packages/TYPO3.CMS/+/66051
  25. Daniel Goerz abandoned the change 10/09/20, 13:34