doctrine / doctrine-laminas-hydrator

Doctrine hydrators for Laminas applications
https://www.doctrine-project.org/projects/doctrine-laminas-hydrator.html
MIT License
33 stars 19 forks source link

type conversion fixed for decimal and bigint #24

Closed lampi87 closed 2 years ago

lampi87 commented 3 years ago

Hello everyone,

I found a bug in the type conversion for decimal. It's casted as string instead float. With this fix it is possible to use strict types in php 7.4

Best regards

lampi87 commented 3 years ago

Hi!

Any comments or suggestions regarding this fix?

Best regards

TomHAnderson commented 3 years ago

I've always disliked that portion of code you've put your fix in. I think it is an appropriate fix and requires a minor version change.

TomHAnderson commented 3 years ago

Actually, I think now that this will require a major version number because we're changing data types. Would love to hear your view on this versioning issue then I'll get it merged asap.

lampi87 commented 3 years ago

I'm not sure about a major version change. In my point of view it's "just" a bugfix for strict types in php7.4 and above. But at the end it's your decision.

driehle commented 2 years ago

Thank you for your time and contribution @lampi87. However, as beberlei pointed out, the current behaviour is correct. A bigint must be casted to string, as bigint exceed PHP's int range. A decimal must be casted to string as well, as floats loose precision, while decimals don't.