Skip to content

Commit

Permalink
Add explanation why we need to cast float to string in decimal type o…
Browse files Browse the repository at this point in the history
…nly starting from PHP 8.1
  • Loading branch information
andrew-demb committed Sep 30, 2021
1 parent 5f6c6e6 commit 9e70e63
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Types/DecimalType.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform)
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
// Some drivers starting from PHP 8.1 can represent decimals as float
// See also: https://github.com/doctrine/dbal/pull/4818
if (PHP_VERSION_ID >= 80100 && is_float($value)) {
return (string) $value;
}
Expand Down

0 comments on commit 9e70e63

Please sign in to comment.