Skip to content
Snippets Groups Projects
  1. Sep 10, 2024
  2. Sep 09, 2024
  3. Sep 07, 2024
  4. Sep 06, 2024
    • Thomas Hohn's avatar
      [BUGFIX] Mitigate exceptions in `LogDataTrait::formatLogDetailsStatic` · d9323c00
      Thomas Hohn authored
      `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
      
      Resolves: #103711
      Releases: main, 12.4
      Change-Id: I7b23eccdc944d2cb068f584b01b52835aca938e9
      Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84004
      
      
      Tested-by: default avatarcore-ci <typo3@b13.com>
      Tested-by: default avatarGarvin Hicking <gh@faktor-e.de>
      Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
      Reviewed-by: default avatarGarvin Hicking <gh@faktor-e.de>
      Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
      d9323c00