Hey guys!
I moved my WI installation from PHP56 to PHP74 and now I get several warnings like this:
PHP Warning: count(): Parameter must be an array or an object that implements Countable in
*/webissues/system/api/querygenerator.inc.php on line 693
It seems to be a common warning when using a php-version 7.0 or newer and I tried several solutions like putting this in an if condition using is_countable($items) etc. but I'm absoluety not an expert in php and the warning is still there.
In the querygenerator.inc.php It's this part, line 693 is the count in the 'IN' case.
private function makeStringCondition( $expression, $type, $value )
{
switch ( $type ) {
case 'EQ':
$this->arguments[] = $value;
return "$expression = %s";
case 'NEQ':
$this->arguments[] = $value;
return "$expression <> %s";
case 'CON':
$this->arguments[] = '%' . $this->escapeLike( $value ) . '%';
return "$expression LIKE %s ESCAPE '!'";
case 'BEG':
$this->arguments[] = $this->escapeLike( $value ) . '%';
return "$expression LIKE %s ESCAPE '!'";
case 'END':
$this->arguments[] = '%' . $this->escapeLike( $value );
return "$expression LIKE %s ESCAPE '!'";
case 'IN':
$items = explode( ', ', $value );
if ( count( $items >= 2 ) ) {
$this->arguments[] = $items;
return "$expression IN ( %%s )";
} else {
$this->arguments[] = $value;
return "$expression = %s";
}
default:
throw new System_Core_Exception( 'Invalid operator' );
}
}
Any recommendations how to fix this? Michal maybe? :)
thanks for your ideas.
best regards
Jan
- Log in to post comments
This line should be:
if ( count( $items ) >= 2 )
. I have no idea why I haven't noticed this error before :). I will fix it in the next release, thanks for letting me know about this.Regards,
Michał
Thx Michał, so easy - now I'm really sad not having fixed It on my own ;D