Review main Abandoned

61250[WIP][POC][TASK] Switch default to prototype services in symfony DI

Benjamin Franzke CR 0 V 0 Easy +49 −0 updated 08/28/19, 09:52

Commit message

This is a bit critical/controversial as containers define
services to be shared by default. PSR-11 does so as well.
Therefore https://review.typo3.org/c/Packages/TYPO3.CMS/+/58255
kept the default value, as suggested by symfony.

BUT: We'll run into problems with autowiring
of the current, stateful classes that rely on the fact
being prototypes.
When these services are wired as dependencies into other
services, symfony DI will share these services
between multiple dependants – even though the
the service might not be prepared for shared use.
(stateful)

Therefore we have to default to non-shared services
(prototypes).

TODO:
 * Maybe this can enable this per extension (choice?)
   that way would could drop this from core
   once we have configured all services, but provide
   this as sane/easy-migratable default for 3rd party
   extensions

Note: This change applies to services without an explicit
shared state. Services that implement SingletonInterface
and services defined in service providers will explicitly be
set to be shared. Therefore the ServiceProviderCompilationPass
is adpated to explicitly share service provider managed
services. (That's what the current spec specifies)

Review

  • Code review CR 0
  • Verified V 0

Files 3

Review log 34

  1. Benjamin Franzke uploaded patch set 1 07/11/19, 17:38

  2. Benjamin Franzke marked it work in progress 07/11/19, 17:39

  3. TYPO3com voted on patch set 1 V +1 07/11/19, 17:48 Completed build in 09m 43s on Thu, 11 Jul, 07:48 PM Test Summary: 46978 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-34928

  4. Benjamin Franzke abandoned the change 08/28/19, 09:52

    Will keep non-prototype as default, as thats what we decided to go with in v10.0.