Review main Merged

71606[BUGFIX] Fix new keyword replacement in ContainerBuilder

Benjamin Franzke CR +2 V +2 Normal +199 −1 updated 10/13/21, 16:52

Commit message

With the introduction of dependency injection a workaround
was added that substitutes `new ClassName(…)` with
`GeneralUtility::makeInstanceForDi(ClassName::class, …)
in the compiled container code. This is used to synchronize
container instances with Singleton usage in GeneralUtility.

It has been forgotten that preg_replace() works across multiple
lines – differently to the command line tool `sed` – and
therefore the regular expression that replaces `new` with
`GeneralUtility::makeInstanceForDi` incorrectly matched
new…( accross multiple lines and caused 'new ' in strings
to be replaced by accident. With the introduction of lazy command
in #93174 it became likely that 'new ' is part of command
descriptions and therefore the regular expression is now adapted
to ignore newlines (and actually any whitespace) between
`new` and the opening parenthesis.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 3

Files 6