Merge pull request #4611 from ac-dc/non-canonical-casts

Fix deprecated non-canonical casts to canonical forms
This commit is contained in:
Marco van 't Wout
2026-01-22 17:05:27 +01:00
committed by GitHub
10 changed files with 23 additions and 21 deletions

View File

@@ -34,6 +34,7 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"
services:
mysql:

View File

@@ -4,6 +4,7 @@
Version 1.1.33 under development
--------------------------------
- Bug #4598: PHP 8.5 compatibility: Fix deprecated non-canonical casts to canonical forms (ac-dc)
- Bug #4607: Fix loading CHttpSessionHandler when using yiilite on Yii 1.1.32 and PHP 7+ (tance77, marcovtwout)
Version 1.1.32 December 23, 2025

View File

@@ -144,8 +144,8 @@ class CDbColumnSchema extends CComponent
switch($this->type)
{
case 'string': return (string)$value;
case 'integer': return (integer)$value;
case 'boolean': return (boolean)$value;
case 'integer': return (int)$value;
case 'boolean': return (bool)$value;
case 'double':
default: return $value;
}

View File

@@ -55,7 +55,7 @@ class CPropertyValue
if (is_string($value))
return !strcasecmp($value,'true') || ($value!=0 && $value!=='' && is_numeric($value));
else
return (boolean)$value;
return (bool)$value;
}
/**
@@ -80,7 +80,7 @@ class CPropertyValue
*/
public static function ensureInteger($value)
{
return (integer)$value;
return (int)$value;
}
/**

View File

@@ -112,8 +112,8 @@ class CTimestamp
protected static function digitCheck($y)
{
if ($y < 100){
$yr = (integer) date("Y");
$century = (integer) ($yr /100);
$yr = (int) date("Y");
$century = (int) ($yr /100);
if ($yr%100 > 50) {
$c1 = $century + 1;

View File

@@ -117,9 +117,9 @@ class CTypeValidator extends CValidator
return false;
if($type==='integer')
return (boolean)preg_match('/^[-+]?[0-9]+$/',trim($value));
return (bool)preg_match('/^[-+]?[0-9]+$/',trim($value));
elseif($type==='double')
return (boolean)preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value));
return (bool)preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value));
elseif($type==='date')
return CDateTimeParser::parse($value,$this->dateFormat,array('month'=>1,'day'=>1,'hour'=>0,'minute'=>0,'second'=>0))!==false;
elseif($type==='time')

View File

@@ -3351,7 +3351,7 @@ class Net_IDNA2
if (self::$_mb_string_overload) {
return mb_strlen($string, '8bit');
}
return strlen((binary)$string);
return strlen((string)$string);
}
// }}}}

View File

@@ -972,11 +972,11 @@ class CHttpRequest extends CApplicationComponent
if($matches[4][$i]==='q')
{
// sanity check on q value
$q=(double)$matches[5][$i];
$q=(float)$matches[5][$i];
if($q>1)
$q=(double)1;
$q=(float)1;
elseif($q<0)
$q=(double)0;
$q=(float)0;
$accept['params'][$matches[4][$i]]=$q;
}
else
@@ -987,7 +987,7 @@ class CHttpRequest extends CApplicationComponent
}
// q defaults to 1 if not explicitly given
if(!isset($accept['params']['q']))
$accept['params']['q']=(double)1;
$accept['params']['q']=(float)1;
$accepts[] = $accept;
}
}

View File

@@ -362,8 +362,8 @@ class CJSON
// return (float)$str;
// Return float or int, as appropriate
return ((float)$str == (integer)$str)
? (integer)$str
return ((float)$str == (int)$str)
? (int)$str
: (float)$str;
} elseif (preg_match('/^("|\').+(\1)$/s', $str, $m) && $m[1] == $m[2]) {

View File

@@ -2775,11 +2775,11 @@ class CHttpRequest extends CApplicationComponent
if($matches[4][$i]==='q')
{
// sanity check on q value
$q=(double)$matches[5][$i];
$q=(float)$matches[5][$i];
if($q>1)
$q=(double)1;
$q=(float)1;
elseif($q<0)
$q=(double)0;
$q=(float)0;
$accept['params'][$matches[4][$i]]=$q;
}
else
@@ -2790,7 +2790,7 @@ class CHttpRequest extends CApplicationComponent
}
// q defaults to 1 if not explicitly given
if(!isset($accept['params']['q']))
$accept['params']['q']=(double)1;
$accept['params']['q']=(float)1;
$accepts[] = $accept;
}
}
@@ -10327,8 +10327,8 @@ class CDbColumnSchema extends CComponent
switch($this->type)
{
case 'string': return (string)$value;
case 'integer': return (integer)$value;
case 'boolean': return (boolean)$value;
case 'integer': return (int)$value;
case 'boolean': return (bool)$value;
case 'double':
default: return $value;
}