Skip to content

Commit 85f9e7c

Browse files
committed
Fix "Non-canonical cast (double) is deprecated" in PHP 8.5
1 parent 617cb63 commit 85f9e7c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ JSON for the XP Framework ChangeLog
33

44
## ?.?.? / ????-??-??
55

6+
* Fixed deprecation warning *Non-canonical cast (double) is deprecated,
7+
use the (float) cast instead* in PHP 8.5
8+
(@thekid)
9+
610
## 6.0.0 / 2025-05-04
711

812
**Heads up:** Dropped support for PHP < 7.4, see xp-framework/rfc#343

src/main/php/text/json/Input.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function valueOf($token, $nesting= 0) {
200200
return null;
201201
} else if (preg_match('/^\-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?$/', $token)) {
202202
return $token > PHP_INT_MAX || $token < -PHP_INT_MAX- 1 || strcspn($token, '.eE') < strlen($token)
203-
? (double)$token
203+
? (float)$token
204204
: (int)$token
205205
;
206206
} else {

0 commit comments

Comments
 (0)