Review main Merged

72087[BUGFIX] Avoid calling htmlspecialchars(null) in DatabaseRecordList

Stefan Bürk CR +2 V +2 Easy +1 −1 updated 11/09/21, 12:58

Commit message

DatabaseRecordList::renderListRow() used the return value of
called BackendUtility::getProcessedValueExtra() to feed it into
php internal htmlspecialchars. As result can be null instead of
a string this emits a E_DEPRECATED PHP 8.1 error. Sanitize call.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Oli Bartsch +1
    • Oliver Klee +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Oli Bartsch +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 911

  1. Stefan Bürk uploaded patch set 1 11/08/21, 19:39

  2. core-ci voted on patch set 1 V +1 11/08/21, 19:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19046

  3. Oliver Klee voted on patch set 1 CR +1 11/08/21, 20:07

  4. Oliver Klee updated the commit message in patch set 2 11/08/21, 20:07

  5. Oliver Klee voted on patch set 2 CR +1 11/08/21, 20:07

  6. core-ci voted on patch set 2 V +1 11/08/21, 20:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19048

  7. Oli Bartsch commented on patch set 2 CR -1 11/09/21, 00:18

    Actual return type of getProcessedValueExtra() is null|string|string[]. Latter will trigger a warning in PHP 8.0: "Warning: Array to string conversion" and the result would be "Array".
  8. Stefan Bürk commented on patch set 2 11/09/21, 06:34

    Reply

    Thanks Oliver for the review. Yes and no. getProcessedValueExtra() has docblock return type hint of string. Anway you are right, as this method calls getRecordPath() which can generally return null|string|string[]. string[] would be returned if 4th parameter is set/true ($fullTitleLimit), with a default of 0. As long as "default" of that signature do not change, the return type chain "is" correc, meaning that return is null|string. Maybe setting that argument for getRecordPath() explict to 0 would make that clearer, but I'm aware that some are on the line to ommit setting argument to the default value. As such the string cast here should be fine for now. Would you confirm with that analysis ?
  9. Oli Bartsch commented on patch set 2 V +1 CR +1 11/09/21, 09:53

    Reply

    ACK
  10. Christian Kuhn voted on patch set 2 V +2 CR +2 11/09/21, 12:54

  11. Christian Kuhn merged patch set 3 11/09/21, 12:58