Skip to content

Commit f9d6337

Browse files
committed
Fix "Non-canonical cast (double) is deprecated" in PHP 8.5
1 parent 0e82405 commit f9d6337

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ JSON patch change log
33

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

6+
## 2.1.1 / 2025-08-16
7+
8+
* Fixed *Non-canonical cast (double) is deprecated* in PHP 8.5 - @thekid
9+
610
## 2.1.0 / 2024-03-24
711

812
* Made compatible with XP 12 - @thekid

src/main/php/text/json/patch/TestOperation.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ public function applyTo(&$target) {
3232
$address= $this->path->resolve($target);
3333
if ($address->exists()) {
3434
$value= $address->value();
35-
if (is_int($value) && is_double($this->value)) {
36-
$equal= (double)$value === $this->value;
37-
} else if (is_double($value) && is_int($this->value)) {
38-
$equal= $value === (double)$this->value;
35+
if (is_int($value) && is_float($this->value)) {
36+
$equal= (float)$value === $this->value;
37+
} else if (is_float($value) && is_int($this->value)) {
38+
$equal= $value === (float)$this->value;
3939
} else {
4040
$equal= Objects::equal($value, $this->value);
4141
}

0 commit comments

Comments
 (0)