-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Cache error while using anonymous class inside controller #30395
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
Are you able to create a small example application that allows to reproduce this issue? That would probably help a lot in identifying the root cause for this. |
The issue is specific. I was trying to provide data to form using anonymous class, which serves as a data wrapper. I think somewhere in form code, it is trying to work with cache, and throws this error. Only in prod env. Please tell me if you need example application if you don't figure out how to reproduce. |
Yes, please create such an example application. |
Unfortunately I have no time to create separate application. Maybe this is not a bug but just requirement not to use anonymous classes with cache system at all. Screenshot |
Can you please share the full stack trace of the error? |
Yeah. But only in image format, sorry. |
Just looking at the stack trace I don't know what causes this error or how to prevent it. Will you be able to provide an application that allows us to reproduce? Otherwise I suggest we close here as there isn't much we can do right now. |
Ok I'm closing due to very specific cache usage (anonymous classes) |
Reopening, I'd like to have a look. |
Confirmed this error. Happens when using anonymous class. |
This PR was merged into the 3.4 branch. Discussion ---------- Fix Cache error while using anonymous class | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #30395 | License | MIT Fix Cache error while using anonymous class Commits ------- 036e722 Fix Cache error while using anonymous class
Symfony version(s) affected: 4.2.3
Description
I got error Uncaught PHP Exception Symfony\Component\Cache\Exception\InvalidArgumentException: "Cache key "@anonymous" contains reserved characters {}()/@:
In my controller action method I am using anonymous class
I was able to fix this by using ordinary, not anonymous class, but I think it should be fixed somehow
The text was updated successfully, but these errors were encountered: