Comments (4)
Similar to #4516
from yii.
Fixed by #4519
from yii.
I've build an workaround (written in PHP 8.2 style), which can be adopted here.
Instead of
if(version_compare(PHP_VERSION,'8.0','>=')) {
$isArray=$param->getType() && $param->getType()->getName()==='array';
} else {
$isArray = $param->isArray();
}
I'm using following code
//repleced by
$isArray = $this->isParameterAnArray($param);
//check whenever given parameter is an array, or not. Supports complex types (intersections, unions) from PHP 8 and above
private function isParameterAnArray($param): bool
{
if (PHP_VERSION_ID < 80000) {
return $param->isArray();
}
foreach ($this->getAllTypes($param) as $complexType) {
if ($complexType && $complexType->getName() === 'array') {
return true;
}
}
return false;
}
//Get all available types. In case an Intersection (PHP >= 8.1) or Union Type (PHP > 8.0) is used, then give all defined types
private function getAllTypes($param): array
{
if ((PHP_VERSION_ID >= 81000) && $param->getType() instanceof ReflectionIntersectionType) {
return $param->getType()->getTypes();
}
if ($param->getType() instanceof ReflectionUnionType) {
return $param->getType()->getTypes();
}
return [$param->getType()];
}
from yii.
Yep, it can be combined and solved together.
from yii.
Related Issues (20)
- Limit and Offset not working correctly with MSSQL HOT 12
- strftime function is deprecated in php 8.1 and used in requirements/index.php getServerInfo HOT 1
- Use of undefined constant id / CGridView widget HOT 2
- Redis Cache - Deprecated: unserialize(): Passing null to parameter #1. HOT 7
- Fatal error: Uncaught CDbException: The table "tablename" for active record class "TablenameRecord" cannot be found in the database. HOT 3
- oci8 schema adapter returns null for 'KEY' field in column info which causes strpos deprecation error HOT 4
- CI tests failing HOT 1
- PHP 8.2 Compatibility HOT 1
- Argument 2 in number_format does not accept null HOT 1
- PHP 8.1 - setcookie(): Passing null to parameter #2 ($value) of type string is deprecated HOT 5
- Bad escaping caracter for SQL server when use compare HOT 2
- CMssqlColumnSchema - error when default column value is SQL SERVER system functions HOT 1
- Error using UnionTypes in action declarations HOT 2
- Regression with MariaDB 10.5.1+ with old temporal types in CDbColumnSchema $dbType HOT 1
- PHAN checks HOT 10
- Deprecated dynamic properties in yii\framework\gii\components\Pear\Text\Diff\Engine\native.php . HOT 6
- CActiveRecord: __construct(): Passing null to parameter #1 ($flags) of type int is deprecated HOT 5
- Upgrading to version 1.1.17+ broke my routes. HOT 1
- PHP 8.3 Compatibility HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii.