Skip to content

Commit 9adbff9

Browse files
staabmondrejmirtes
authored andcommitted
Fix PHP8.5 Warning: "unexpected NAN value was coerced to string"
1 parent bf9d323 commit 9adbff9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Type/Constant/ConstantFloatType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ private function castFloatToString(float $value): string
4949
$precisionBackup = ini_get('precision');
5050
ini_set('precision', '-1');
5151
try {
52+
if (is_nan($value)) {
53+
return 'NAN';
54+
}
55+
5256
$valueStr = (string) $value;
5357
if (is_finite($value) && !str_contains($valueStr, '.')) {
5458
$valueStr .= '.0';

0 commit comments

Comments
 (0)