This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony
Fabien Potencier e1ffb3341d bug #23729 [Bridge\ProxyManager] Dont call __destruct() on non-instantiated services (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[Bridge\ProxyManager] Dont call __destruct() on non-instantiated services

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

While working on making #23678 green, I discovered that if a lazy service implements `__destruct`, then that service is not lazy anymore: it is created at destruct time.
That behavior is documented at https://github.com/Ocramius/ProxyManager/issues/258 (+related issues).

While I may understand why this behavior is the default for ProxyManager, it does not fit our "lazy-services" use case to me. Typically, nobody wants a database connection to be created to destruct the uninitialized lazy-proxy.

Blocks #23678

Commits
-------

2d79ffa0ca [Bridge\ProxyManager] Dont call __destruct() on non-instantiated services
2017-08-03 14:06:53 +02:00
..
Bridge [Bridge\ProxyManager] Dont call __destruct() on non-instantiated services 2017-08-03 13:36:00 +02:00
Bundle allow to configure custom formats in XML configs 2017-07-09 16:08:05 +02:00
Component bumped Symfony version to 2.7.34 2017-08-01 09:21:40 +02:00