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
enable_lazy_ghost_objects: true
prevents detection of proxy creation errors at Symfony compile time
#11402
Comments
Can you share the stack trace of the exception you got to see when it was triggered in each case ? |
Below you will find my initial reply, but I found the trigger in production while trying to get the full stack trace. It is the opcache Versions
Stack trace for the prod cache clear functional test when it fails with
In production when it fails with
|
Indeed, the new implementation of ProxyFactory does not seem to validate the compatibility of classes at proxy generation time, but only when the proxy class is used. /cc @nicolas-grekas |
I guess this is an issue in var-dumper? Shall we close here? |
I think this is for the ORM. VarExporter's lazy objects are compatible with readonly classes. But I'm not sure the ORM takes care of them properly (either failing early or generaton readonly proxies.) |
Can you create a reproducer for this issue? |
I'll make time next week for that. |
The error "the Unable to create a proxy for a readonly class" is only triggered when lazy ghost objects is false during |
Some hints, A reproducer for the fatal error with lazy proxy should be a test with a readonly class, see |
enable_lazy_ghost_objects: false
is deprecated, but when it istrue
, clearing the Symfony cache is not enough to get theUnable to create a proxy for a readonly class
error. It is only when the proxy class is used that we get it.So in dev we have
auto_generate_proxy_classes: true
and we didn't get an error when developing. I guess the problematic proxy was not used in the development use case.In production we have
auto_generate_proxy_classes: false
as recommended. We also have a functional test to check that the prod Symfony cache can be cleared. It passed the test.It's only when we released and used the proxy class that we got the
Unable to create a proxy for a readonly class
.With
enable_lazy_ghost_objects: false
everything works fine, but we have a deprecation message.The text was updated successfully, but these errors were encountered: