Review 12.4 Merged

85920[BUGFIX] Mitigate exceptions in `LogDataTrait::formatLogDetailsStatic`

Stefan Bürk CR +2 V +2 Hard +301 −54 updated 09/06/24, 19:14

Commit message

`LogDataTrait::formatLogDetailsStatic()` simple used `vsprintf()`
in case that the string contains any `%` characters and throws
either a `\ValueError` or `\ArgumentCountError` depending if no
value exists or the count does not match.

It is not reliable and implement additional lexing here to avoid
the exception by not calling `vsprintf()` upfront.

This change calls `vsprintf()` and handles the mentioned exceptions
and use the fallback handling in case exception has been thrown as
a simplefied approach. Tests are added to cover legacy, mixed and
new log format option along with static and instanced method calls.

Note that a minor inline PHP DocBlock annotation has been added
in `LogDataTrait` to mitigate detection issues of PHPStan, which
allows now to remove baseline ignore patterns in the same run.

Used command(s):

> Build/Scripts/runTests.sh -s phpstanGenerateBaseline

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
  • Verified V +2 Done
    • Stefan Bürk +2
    • core-ci +1 CI

Issues 1

Files 4

Review log 34

  1. Stefan Bürk uploaded patch set 1 09/06/24, 18:56

  2. core-ci voted on patch set 1 V +1 09/06/24, 19:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64996

  3. Stefan Bürk voted on patch set 1 CR +2 V +2 09/06/24, 19:14

  4. Stefan Bürk merged patch set 2 09/06/24, 19:14