Skip to content

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

Closed
@Selion05

Description

@Selion05

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions