vincenthedan Posted July 28, 2010 Share Posted July 28, 2010 Hi guys, right after check out (which goes fine), I get this: Warning: strlen() expects parameter 1 to be string, array given in /home/dismagig/public_html/catalog/includes/functions/general.php on line 163 Warning: Cannot modify header information - headers already sent by (output started at /home/dismagig/public_html/catalog/includes/functions/general.php:163) in /home/dismagig/public_html/catalog/includes/functions/general.php on line 33 No idea what's going on. I can see the order on the admin panel, but this warning message right after the check out is quite disturbing... Any solution? Link to comment Share on other sites More sharing options...
Jan Zonjee Posted July 28, 2010 Share Posted July 28, 2010 right after check out (which goes fine), I get this: Warning: strlen() expects parameter 1 to be string, array given in /home/*******/public_html/catalog/includes/functions/general.php on line 163 Might be the bug that was fixed in the section labeled [C] Update product notifications in the update.html that comes with the download of RC2a. Link to comment Share on other sites More sharing options...
wayand Posted August 27, 2010 Share Posted August 27, 2010 Might be the bug that was fixed in the section labeled [C] Update product notifications in the update.html that comes with the download of RC2a. I am using the latest version of Oscommerce webshop RC2a but still I get the same Warning ( strlen() expects parameter 1 to be string, array given in general.php ). Please some one help. Link to comment Share on other sites More sharing options...
wayand Posted August 29, 2010 Share Posted August 29, 2010 I just fond out that the warning will not come agian if you set the Enable GZip Compression to "true" in Admin. But I still dont know why it helps. so if anyone out there know this please help .... Link to comment Share on other sites More sharing options...
wayand Posted August 30, 2010 Share Posted August 30, 2010 here is the solution, for this warning: ****** Warning: strlen() expects parameter 1 to be string, array given in /home/***/public_html/catalog/includes/functions/general.php on line 163 *********** replace this: // Return all HTTP GET variables, except those passed as a parameter function tep_get_all_get_params($exclude_array = '') { global $HTTP_GET_VARS; if (!is_array($exclude_array)) $exclude_array = array(); $get_url = ''; if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) { reset($HTTP_GET_VARS); while (list($key, $value) = each($HTTP_GET_VARS)) { if ( (strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y') ) { $get_url .= $key . '=' . rawurlencode(stripslashes($value)) . '&'; } } } return $get_url; } //// By this: // Return all HTTP GET variables, except those passed as a parameter function tep_get_all_get_params($exclude_array = '') { global $HTTP_GET_VARS; if (!is_array($exclude_array)) $exclude_array = array(); $get_url = ''; if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) { reset($HTTP_GET_VARS); while (list($key, $value) = each($HTTP_GET_VARS)) { if ( is_string($value) && (strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y') ) { $get_url .= $key . '=' . rawurlencode(stripslashes($value)) . '&'; } } } return $get_url; } //// ************ :thumbsup: Wayand Link to comment Share on other sites More sharing options...
MrPhil Posted August 30, 2010 Share Posted August 30, 2010 While that will fix the immediate problem (passing an array rather than a string to strlen()), it would be better to figure out why you have an array within your $HTTP_GET_VARS/$_GET array. Is this a hack, or a coding error, or is there really supposed to be an array there? Link to comment Share on other sites More sharing options...
mondobongo3 Posted September 21, 2010 Share Posted September 21, 2010 While that will fix the immediate problem (passing an array rather than a string to strlen()), it would be better to figure out why you have an array within your $HTTP_GET_VARS/$_GET array. Is this a hack, or a coding error, or is there really supposed to be an array there? Was this problem solved beyond a "immediate solution"? I have the same problem and I don't know if to wait for a solution, or to apply the solution posted above? Thanks. Link to comment Share on other sites More sharing options...
Chadduck Posted October 1, 2010 Share Posted October 1, 2010 While that will fix the immediate problem (passing an array rather than a string to strlen()), it would be better to figure out why you have an array within your $HTTP_GET_VARS/$_GET array. Is this a hack, or a coding error, or is there really supposed to be an array there? Since I am a true novice at this (and based upon this comment) I went to the osQuantum Development Forums who offer many many different fixes for OSCommerce. The forums are located here for OSCommerce specifically - http://forums.osquantum.org/index.php?showforum=3 I gave them the ORIG code and the fix given above by wayand. This was their reply... REPLACE WITH // Return all HTTP GET variables, except those passed as a parameter function tep_get_all_get_params($exclude_array = '') { global $_GET; 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)) { if ( (strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y') ) { $get_url .= $key . '=' . rawurlencode(stripslashes($value)) . '&'; } } } return $get_url; } Hope that helps... BJ Link to comment Share on other sites More sharing options...
owoyalefemi Posted October 28, 2010 Share Posted October 28, 2010 Since I am a true novice at this (and based upon this comment) I went to the osQuantum Development Forums who offer many many different fixes for OSCommerce. The forums are located here for OSCommerce specifically - http://forums.osquantum.org/index.php?showforum=3 I gave them the ORIG code and the fix given above by wayand. This was their reply... REPLACE WITH // Return all HTTP GET variables, except those passed as a parameter function tep_get_all_get_params($exclude_array = '') { global $_GET; 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)) { if ( (strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y') ) { $get_url .= $key . '=' . rawurlencode(stripslashes($value)) . '&'; } } } return $get_url; } Hope that helps... BJ Hello, Please,help! The same thing happened to me but mine was on line 33: public_html/includes/functions/general.php on line 33 Link to comment Share on other sites More sharing options...
MrPhil Posted November 4, 2010 Share Posted November 4, 2010 What is line 33 in your copy of the file? In standard osC 2.2 RC2a, that line is header('Location: ' . $url); If you're getting "strlen() expects parameter 1..." errors, the closest strlen() is in lines 28 through 30: if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url $url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL } HTTP_SERVER should be a simple string like "http://yoursite.com". Is HTTP_SERVER properly defined in your includes/configure.php file? Link to comment Share on other sites More sharing options...
DriWashSolutions Posted July 12, 2012 Share Posted July 12, 2012 FWIW - I just started getting this as well, and it coincides with my host upgrading to PHP 5.3 John Skurka Link to comment Share on other sites More sharing options...
pichou2005 Posted August 26, 2012 Share Posted August 26, 2012 Hi, Me too, the same problem since my host has upgraded to PHP 5.3 I've use the solution of Wayand (post #5) with success. Thank you very much Wayand !! :thumbsup: Link to comment Share on other sites More sharing options...
♥FWR Media Posted August 26, 2012 Share Posted August 26, 2012 As MrPhil already stated HTTP_SERVER is a define in catalog/includes/configure.php, PHP 5.3 nor the latest 5.4.6 changes this fact. Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work. Link to comment Share on other sites More sharing options...
intensivex Posted November 10, 2012 Share Posted November 10, 2012 The issue stems from customers checking off the "Notify me of Product updates" at checkout. Here is a replacement for the entire function, with some additional logic. Picked off of the zenCart forums and converted back to OSC: function tep_get_all_get_params($exclude_array = '') { if (!is_array($exclude_array)) $exclude_array = array(); $exclude_array = array_merge($exclude_array, array(tep_session_name(), 'error', 'x', 'y')); $get_url = ''; if (is_array($_GET) && (sizeof($_GET) > 0)) { reset($_GET); while (list($key, $value) = each($_GET)) { if (is_array($value) || in_array($key, $exclude_array)) continue; if (strlen($value) > 0) { $get_url .= tep_sanitize_string($key) . '=' . rawurlencode(stripslashes($value)) . '&'; } } } while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url); while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url); return $get_url; } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.