Re: A non-numeric value ?
Quote:
Originally Posted by
Ang_l
Hi,
I upgrade to 1.5.5f, but i think the error is comming after i change PHP Version to 7.1
that is from MyDEBUG fail :
PHP Warning: A non-numeric value encountered in /home/ga.....m/includes/classes/categories_ul_generator.php on line 58
zen_categories_ul_generator->buildBranch() called at [/h ... ludes/classes/categories_ul_generator.php:85]
zen_categories_ul_generator->buildTree() called at [/ho ... /includes/templates/westminster_new/templates/tpl_modules_mobile_categories_tabs.php:122]
require(/hom... /includes/templates/westminster_new/templates/tpl_modules_mobile_categories_tabs.php) called at [/home ...emplates/westminster_new/common/tpl_header.php:121]
line 58 from catefories_ul_generator.php is: $result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. ($level+1) . '"' : '' );
line 85 from categories_ul_generator.php is: return $this->buildBranch($this->root_category_id, '', $submenu);
line 122 from tpl_modules_mobile_categories_tabs is: $menulist = $zen_CategoriesUL->buildTree(true);
This issue has been corrected for the (in-progress) Zen Cart 1.5.6 release by the following insertion into /includes/classes/categories_ul_generator.php's BuildBranch function:
Code:
function buildBranch($parent_id, $level = 0, $submenu=true, $parent_link='')
{
$level = (int)$level;
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. ($level+1) . '"' : '' );
if (($this->data[$parent_id])) {
Re: A non-numeric value ?
my experience with later versions of php7 require the casting back to a string.
Code:
function buildBranch($parent_id, $level = 0, $submenu=true, $parent_link='')
{
$level = (int)$level;
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. (string)($level+1) . '"' : '' );
if (($this->data[$parent_id])) {
Re: A non-numeric value ?
Quote:
Originally Posted by
carlwhat
my experience with later versions of php7 require the casting back to a string.
Code:
function buildBranch($parent_id, $level = 0, $submenu=true, $parent_link='')
{
$level = (int)$level;
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. (string)($level+1) . '"' : '' );
if (($this->data[$parent_id])) {
You should submit a PR, then, since the code I posted is the current version on the Zen Cart v156 GitHub.
Re: A non-numeric value ?
my mistake... i am not able to replicate the error using php7.1 or php7.2.
Re: A non-numeric value ?
Thank you!
After i find this
https://www.zen-cart.com/showthread....PHP-7-warnings
i changed categories_ul_generator.php with ...el'. (float)($level+1) . '"... that is correct? Or must change again with (string)?
Now i changed and /includes/modules/pages/advanced_search_result/header_php.php:
$rate = $currencies->get_value($_SESSION['currency']);
if ($rate) {
$pfrom = (float)$_GET['pfrom'] / $rate;
$pto = (float)$_GET['pto'] / $rate;
}
Re: A non-numeric value ?
no need to add string.
best.
Re: A non-numeric value ?