Quote Originally Posted by laksh0302 View Post
Hi there

I have been reading the thread to resolve the PHP Warning: strlen() expects parameter 1 to be string error but to no avail.

I have tried and done each and every thing mentioned in the thread.

I have a zen cart 1.5.1 (upgraded version) and major mods installed are: IH4, Multi cross sell and Dynamic filter. URL: http://artemisia.com/store/

The problem is when I click Add to Cart button, it gives me a blank page with the warning.

Hosting Details:

Server OS: Linux 2.6.18-238.19.1.el5PAE
Database: MySQL 5.0.96-log
PHP Version: 5.3.24 (Zend: 2.3.0)
PHP Memory Limit: 64M
PHP Safe Mode: Off
PHP File Uploads: On
Max Size: 32M
Database Data Size: 7,920 kB

Following is what my functions_general.php file looks like:

PHP Code:
// Return all HTTP GET variables, except those passed as a parameter
function zen_get_all_get_params($exclude_array ''$search_engine_safe true) {

if (!
is_array($exclude_array)) $exclude_array = array();

$get_url '';
if (
is_array($_GET) && (sizeof($_GET) > 0)) {
reset($_GET);
while (list(
$key$value) = each($_GET)) {
// bof dynamic filter 1 of 3
if ( (!in_array($key$exclude_array)) && (strlen($value) > || is_array($value) && array_filter($value) ) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {
// eof dynamic filter 1 of 3
if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
// die ('here');
$get_url .= $key '/' rawurlencode(stripslashes($value)) . '/';
} else {
// bof dynamic filter 2 of 3
if (is_array($value)) {
foreach(
$value as $arr){
$get_url .= zen_sanitize_string($key) . '[]=' rawurlencode(stripslashes($arr)) . '&';
}
} else {
// eof dynamic filter 2 of 3
$get_url .= zen_sanitize_string($key) . '=' rawurlencode(stripslashes($value)) . '&';
// bof dynamic filter 3 of 3
}
// eof dynamic filter 3 of 3
}
}
}
}
while (
strstr($get_url'&&')) $get_url str_replace('&&''&'$get_url);
while (
strstr($get_url'&&')) $get_url str_replace('&&''&'$get_url);

return 
$get_url;

Please help me out.


Thanks
The code for 1.5.1 should be:
PHP Code:
// bof dynamic filter 1 of 3
        
if ( (!in_array($key$exclude_array)) && (is_string($value) && strlen($value) > || is_array($value) && array_filter($value) ) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {
// eof dynamic filter 1 of 3
          
if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) )
          {
//    die ('here');
            
$get_url .= $key '/' rawurlencode(stripslashes($value)) . '/';
          }
          else
          {
// bof dynamic filter 2 of 3
            
if (is_array($value))
            {
              foreach(
$value as $arr)
              {
                
$get_url .= zen_sanitize_string($key) . '[]=' rawurlencode(stripslashes($arr)) . '&';
              }
            }
            else
            {
// eof dynamic filter 2 of 3
              
$get_url .= zen_sanitize_string($key) . '=' rawurlencode(stripslashes($value)) . '&';
// bof dynamic filter 3 of 3
            
}
// eof dynamic filter 3 of 3
          
}
        }
      }
    }
    while (
strstr($get_url'&&')) $get_url str_replace('&&''&'$get_url);
    while (
strstr($get_url'&&')) $get_url str_replace('&&''&'$get_url);

    return 
$get_url;
  }