Getting this , how to fix
PHP Warning: trim() expects parameter 1 to be string, array given in ../includes/functions/functions_general.php on line 63
Getting this , how to fix
PHP Warning: trim() expects parameter 1 to be string, array given in ../includes/functions/functions_general.php on line 63
Considering how little information is provided to reproduce the issue, the only answer I can undoubtedly and without question provide is to ensure that parameter 1 is a string...
A more pointed answer might be possible if knew things like what version of Zen Cart is actually installed, what version of PHP is active, what changes have been incorporated into the site, what the call history is/was when this issue arose, etc...
Last edited by mc12345678; 27 Dec 2018 at 06:46 AM. Reason: Was hard to find, but v155 was asked about
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
PHP 7.0
PHP Warning: trim() expects parameter 1 to be string, array given in /includes/functions/functions_general.php on line 63
[27-Dec-2018 09:55:03 Asia/Kolkata] Request URI: /?selid[201]=1379, IP address: 182.56.82.231
#1 trim() called at [/includes/functions/functions_general.php:63]
#2 zen_parse_input_field_data() called at [/includes/functions/functions_general.php:77]
#3 zen_output_string() called at [/includes/functions/html_output.php:699]
#4 zen_draw_hidden_field() called at [/includes/modules/header_currencies.php:33]
#5 require(/includes/modules/header_currencies.php) called at [/includes/templates/sstailor/common/tpl_header.php:276]
#6 require(/includes/templates/sstailor/common/tpl_header.php) called at [/includes/templates/sstailor/common/tpl_main_page.php:183]
#7 require(/includes/templates/sstailor/common/tpl_main_page.php) called at [/index.php:97]
Looks like the issue might be in:
at or before line: 276. Either that or the header_currencies file has been modified, but by it being in the normal "core" area, it doesn't seem that there are any changes. :)Code:/includes/templates/sstailor/common/tpl_header.php
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
the header_currency file is as follows
// test if box should display
$show_currencies= false;
// don't display on checkout page:
if (substr($current_page, 0, 8) != 'checkout') {
$show_currencies= true;
}
if ($show_currencies == true) {
if (isset($currencies) && is_object($currencies)) {
reset($currencies->currencies);
$currencies_array = array();
while (list($key, $value) = each($currencies->currencies)) {
$currencies_array[] = array('id' => $key, 'text' => (zen_not_null($value['symbol_left']) ? $value['symbol_left'] : $value['symbol_right']) );
}
$hidden_get_variables = '';
reset($_GET);
while (list($key, $value) = each($_GET)) {
if ( ($key != 'currency') && ($key != zen_session_name()) && ($key != 'x') && ($key != 'y') ) {
$hidden_get_variables .= zen_draw_hidden_field($key, $value);
}
}
require($template->get_template_dir('tpl_header_currencies.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header_currencies.php');
}
}
That code is not standard to Zen Cart and in a way is causing the issue reported...
Specifically while processing the $_GET parameter data, if that is somehow provided as an array (information on the URI) then that will lead to the reported problem. To prevent it from possibly happening, the following might work:
Code:<?phpCode:// test if box should display $show_currencies= false; // don't display on checkout page: if (substr($current_page, 0, 8) != 'checkout') { $show_currencies= true; } if ($show_currencies == true) { if (isset($currencies) && is_object($currencies)) { reset($currencies->currencies); $currencies_array = array(); while (list($key, $value) = each($currencies->currencies)) { $currencies_array[] = array('id' => $key, 'text' => (zen_not_null($value['symbol_left']) ? $value['symbol_left'] : $value['symbol_right']) ); } $hidden_get_variables = ''; reset($_GET); while (list($key, $value) = each($_GET)) {Code:if (is_array($key)) continue;if ( ($key != 'currency') && ($key != zen_session_name()) && ($key != 'x') && ($key != 'y') ) { $hidden_get_variables .= zen_draw_hidden_field($key, $value); } } require($template->get_template_dir('tpl_header_currencies.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header_currencies.php'); } }
Was the below portion of the URI on purpose?
?selid[201]=1379or was it just something someone had tried?
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Its On Purpose
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Thanks a lot
Bookmarks