Skip to content

Commit 6290081

Browse files
committed
Fix "Non-canonical cast (double) is deprecated"
1 parent 1c5fc3f commit 6290081

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ RDBMS support for the XP Framework: MySQL, Sybase, MSSQL, PostgreSQL, SQLite3, I
55

66
## 13.4.0 / 2025-08-16
77

8+
* Fixed *Non-canonical cast (double) is deprecated* in PHP 8.5 - @thekid
89
* Added compatibility with `xp-framework/math` version 10.0+ - @thekid
910

1011
## 13.3.0 / 2024-03-24

src/main/php/rdbms/mysqlx/AbstractMysqlxResultSet.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ protected function record($record, $field= null) {
4545
if ($value <= PHP_INT_MAX && $value >= -PHP_INT_MAX- 1) {
4646
$return[$info['name']]= (int)$value;
4747
} else {
48-
$return[$info['name']]= (double)$value;
48+
$return[$info['name']]= (float)$value;
4949
}
5050
break;
5151

5252
case 4: // FLOAT
5353
case 5: // DOUBLE
5454
case 0: // DECIMAL
5555
case 246: // NEWDECIMAL
56-
$return[$info['name']]= (double)$value;
56+
$return[$info['name']]= (float)$value;
5757
break;
5858

5959
case 253: // CHAR

src/main/php/rdbms/tds/TdsRecord.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected function toDate($days, $seconds) {
2828
*
2929
* @param int hi
3030
* @param int lo
31-
* @return double
31+
* @return float
3232
*/
3333
protected function toMoney($hi, $lo= 0) {
3434
if ($hi < 0) {
@@ -38,7 +38,7 @@ protected function toMoney($hi, $lo= 0) {
3838
} else {
3939
$div= 10000;
4040
}
41-
return (double)bcdiv(bcadd(bcmul($hi, '4294967296'), $lo), $div, 5);
41+
return (float)bcdiv(bcadd(bcmul($hi, '4294967296'), $lo), $div, 5);
4242
}
4343

4444
/**
@@ -74,7 +74,7 @@ protected function toNumber($n, $scale, $prec) {
7474
return bccomp($n, PHP_INT_MAX) == 1 || bccomp($n, -PHP_INT_MAX -1) == -1 ? $n : (int)$n;
7575
} else {
7676
$n= bcdiv($n, pow(10, $scale), $scale);
77-
return strlen($n) > self::$precision ? $n : (double)$n;
77+
return strlen($n) > self::$precision ? $n : (float)$n;
7878
}
7979
}
8080

0 commit comments

Comments
 (0)