Skip to content

[Serializer] Allow to pass flags to XmlEncoder #17987

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
rvanlaak opened this issue Mar 2, 2016 · 3 comments
Closed

[Serializer] Allow to pass flags to XmlEncoder #17987

rvanlaak opened this issue Mar 2, 2016 · 3 comments

Comments

@rvanlaak
Copy link
Contributor

rvanlaak commented Mar 2, 2016

Ever since we upgraded our server, libxml was upgraded to 2.9, which introduced a protection on the max text length.

We have one single route for which we want to add LIBXML_PARSEHUGE to the XmlEncoder, because an external party delivers us huge text nodes. Our problem is that the decoding happens (and makes the application crash) pre-controller in the FOS\RestBundle\EventListener\BodyListener:114. See #17956 and #16873 for more background information. What should be done to solve this:

@dunglas
Copy link
Member

dunglas commented Mar 6, 2016

I've opened a pr to make the encoder configurable: #18036

However I'm not sure that exposing this configuration trough the framework bundle is a good idea: changing options globally through this configuration option will impact all usages of this encoder. For instance if someone enable non-safe options to fit its own need with a custom development, it will also impact API Platform that uses encoders registered by the bundle.
IMO it's better to encourage option to register a new instance of the encoder with custom options than changing globally options of all encoders.
If there are use cases where options should be changed globally, the service definition of the default encoder can be easily overridden in the app/config/services.yml file.

@rvanlaak
Copy link
Contributor Author

rvanlaak commented Mar 7, 2016

@dunglas agree with you, my usecase just concerns a single route. If your PR and overriding or decorating the BodyListener via services.yml will be able to solve this I'm fine with that. 👍

@rvanlaak
Copy link
Contributor Author

We can override the setting once this PR is fixed?

@fabpot fabpot closed this as completed Mar 31, 2016
fabpot added a commit that referenced this issue Mar 31, 2016
…(dunglas)

This PR was squashed before being merged into the 3.1-dev branch (closes #18036).

Discussion
----------

[Serializer] XmlEncoder: Make load flags configurable

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

Commits
-------

0826068 [Serializer] XmlEncoder: Make load flags configurable
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