Skip to content
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

Yml serializer don't serialize empty arrays #183

Closed
eduardosoliv opened this issue Nov 22, 2013 · 2 comments
Closed

Yml serializer don't serialize empty arrays #183

eduardosoliv opened this issue Nov 22, 2013 · 2 comments

Comments

@eduardosoliv
Copy link

    public function testEmptyArray()
    {
        $serializer = SerializerBuilder::create()->build();
        $ymlContent = $serializer->serialize(array('t' => array()), 'yml');
        echo $ymlContent; // prints t:

        // Symfony Yaml component
        print_r(Yaml::parse($ymlContent));
        print_r(Yaml::parse('t: []'));
    }

Running the test get:

t:
Array
(
    [t] => 
)
Array
(
    [t] => Array
        (
        )

)

Is this expected behavioral? Any way to configure it to serialize empty array as []?

Or is bug and should try to fix it in the code and open PR?

@Tobion
Copy link
Contributor

Tobion commented Nov 30, 2013

Looks like another inconsistency in serialization representation. In JSON empty arrays are serialized.
See also #124

@soullivaneuh
Copy link
Contributor

@entering @Tobion I wrote a PR to fix it. If you could please take a look. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants