Skip to content

Commit

Permalink
Merge pull request #4833 from andrew-demb/decimal-cast-explanation
Browse files Browse the repository at this point in the history
Add explanation why we need to cast float to string in decimal type
  • Loading branch information
greg0ire authored Oct 2, 2021
2 parents c9527c4 + d50315e commit d3df7c9
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 d3df7c9

Please sign in to comment.