-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[VarExporter][FrameworkBundle][7.0] Error when using a lazy AbstractController
#52753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you please provide a small reproducer? |
Can you please try replacing the current code by this and let us know if this fixes it?
|
Yes that is the fix on our side
Yes that works as well, the memory issues i got when i first tried this solution are caused by another issue, that is independent. |
Also, why is your controller registered as a lazy service? |
A more low-level fix should be #52762. |
…ts, fixing nullsafe-related behavior (nicolas-grekas) This PR was merged into the 6.3 branch. Discussion ---------- [VarExporter] Work around php/php-src#12695 for lazy objects, fixing nullsafe-related behavior | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | #52753 | License | MIT This PR fixes another issue discovered with `@arnaud`-lb while working on lazy-objects. The root of the issue is described in php/php-src#12695 and this PR implements a fix based on a suggestion by `@iluuu1994` Only ghost objects are affected; proxy objects are OK. Commits ------- b051700 [VarExporter] Work around php/php-src#12695 for lazy objects, fixing nullsafe-related behavior
Symfony version(s) affected
7.0
Description
For 7.0 the protected
$container
property was typed asContainerInterface
, this leads to an error when using it together with theLazyGhost
as it tries to access the property before it is initialized.How to reproduce
Extend the AbstractController, configure it in the container as lazy and with the
setContainer
methodPossible Solution
Catch the exception, and set null as fallback:
Before:
After:
I tried to use isset instead of null coalesce, but that leads to memory issues, so i guess catching the exception would be best
Additional Context
See stack trace:
The text was updated successfully, but these errors were encountered: