schmittjoh / serializer

Library for (de-)serializing data of any complexity (supports JSON, and XML)
http://jmsyst.com/libs/serializer
MIT License
2.32k stars 586 forks source link

serialize() throws error when object has member of type "float|int|null" #1562

Closed captain-igloo closed 3 weeks ago

captain-igloo commented 4 weeks ago
Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no

The following code throws an error under version 3.31.0 but not under 3.30.0:

class Foo
{
    public float|int|null $a = 99;
}

$serializer = SerializerBuilder::create()->build();
$serializer->serialize(new Foo(), 'json');

The error is:

In Parser.php line 30:                                                                                       
JMS\Serializer\Type\Parser::parse(): Return value must be of type array, null returned
kargpfen commented 4 weeks ago

I have the same problem 🙁

scyzoryck commented 4 weeks ago

Thanks! I will take a look in the evening on this issue.

KevinMarques commented 4 weeks ago

Same here. Thank you for taking a look ;)

igordeveloper commented 3 weeks ago

Thanks! I will take a look in the evening on this issue.

Thank you @scyzoryck

Do you believe it is a quick error to fix, or will it take a long time?

scyzoryck commented 3 weeks ago

3.31.0 released!

igordeveloper commented 3 weeks ago

3.31.0 released!

thank you.

kargpfen commented 3 weeks ago

Thanks for release 3.31.1