8000 Deserializing an Xml file into an Object can cause `Cache key "p@triggers" contains reserved characters {}()/\@:` · Issue #29293 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Deserializing an Xml file into an Object can cause Cache key "p@triggers" contains reserved characters {}()/\@: #29293

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

Closed
mvscheidt opened this issue Nov 23, 2018 · 0 comments

Comments

@mvscheidt
Copy link

Symfony version(s) affected: 4.1.7, 4.1.5 (Serializer Component)

Description

CacheItem throws an Error: Cache key "p@triggers" contains reserved characters {}()/\@: when using the Serializer Services deserialize Method in combination with ObjectNormalizer and XmlEncoder (by passing an XML File and an Object to normalize, see Reproducer below)

This seems to happen when attributes are set on the xml "root" node.

How to reproduce

Command 1. just outputs some data.

Command 2. Fails with Cache key "p@triggers" contains reserved characters {}()/\@:

You can work around the issue by replacing $this->serializer = $serializer; in \App\Command\XmlCommand with $this->serializer = new Serializer([new ObjectNormalizer()], [new XmlEncoder()]);

The reason this works is probably because no "Caching" happens for the deserialize process, at least not in a way that it triggers the CacheItem.

Additional context

You can open the public folder where both test files reside, the only difference between them is that the root node in rootattributes.xml has an attribute.

There has been another ticket with a similar error message, but I think the cause there was different altogether (#26313)

@fabpot fabpot closed this as completed Nov 26, 2018
fabpot added a commit that referenced this issue Nov 26, 2018
…kas)

This PR was merged into the 3.4 branch.

Discussion
----------

[PropertyAccessor] fix encoding of cache keys

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

Commits
-------

4568a0c [PropertyAccessor] fix encoding of cache keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0