PHP 7.4 CDbCriteria.php warning: count(): Parameter must be an array or an object that implements Countable
ODware opened this issue · 1 comments
ODware commented
What steps will reproduce the problem?
$warehouseIds = null;
$criteria->addInCondition('t.warehouse_id', $warehouseIds);
What do you get ?
PHP warning
count(): Parameter must be an array or an object that implements Countable
in framework/db/schema/CDbCriteria.php(276)
Patch (compatible with all php versions)
--- if(($n=count($values))<1)
+++ if(($n=count((is_array($values)?$values:array())))<1)
Additional info
Q | A |
---|---|
Yii version | 1.1.25 |
PHP version | 7.4 |
Operating system | Debian 11 |
marcovtwout commented
This is not a framework bug: you should pass the second parameter as an array per documentation: https://www.yiiframework.com/doc/api/1.1/CDbCriteria#addInCondition-detail