Skip to content

[Serializer] XmlEncoder -Call to a member function normalize() on null #35824

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
Selion05 opened this issue Feb 22, 2020 · 0 comments
Closed

Comments

@Selion05
Copy link

Selion05 commented Feb 22, 2020

Symfony version(s) affected: 4.4.4

Description

How to reproduce

<?php

require __DIR__ . '/vendor/autoload.php';

$data = [
    'item' => [
        '@attr' => null,
    ],
];

$encoder = new \Symfony\Component\Serializer\Encoder\XmlEncoder('some-context');

echo $encoder->encode($data, 'xml', ['xml_format_output' => true]);

Possible Solution
Add a null check here

@Selion05 Selion05 added the Bug label Feb 22, 2020
@fabpot fabpot closed this as completed Feb 29, 2020
fabpot added a commit that referenced this issue Feb 29, 2020
This PR was merged into the 3.4 branch.

Discussion
----------

[Serializer] prevent method calls on null values

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35824
| License       | MIT
| Doc PR        |

Commits
-------

847d6dc prevent method calls on null values
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