gold1s
gold1s

Reputation: 21

Warning: strlen() expects parameter 1 to be string, array given in file... in line

I have this error:

Warning: strlen() expects parameter 1 to be string, array given in /includes/functions/general.php on line 159

Line 159 is:

if ((strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y')) {

Could you help me solving this problem?

Upvotes: 1

Views: 1590

Answers (1)

Ronan Boiteau
Ronan Boiteau

Reputation: 10138

strlen() only works for strings. From the strlen() documentation:

strlen() returns NULL when executed on arrays, and an E_WARNING level error is emitted.


If you have an array, use count() to count the elements:

if (count($value) > 0)

Upvotes: 2

Related Questions