Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
Quote:
Originally Posted by
mesnitu
Thanks!!!
Less one problem !
The issue was on the modify file. It had this
$list_box_contents ='';
instead of this
$list_box_contents = array();
... don't know why, probably some update that I miss.
Now it ok !
Good. Yes, php is becoming more stringent about properly identifying how a variable is intended to be used and basically validating that the data is the type expected to use as well as other improvements in the language.
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
Code:
[13-Jan-2018 18:24:07 Europe/Lisbon] PHP Warning: A non-numeric value encountered in /home/xxxxxx/public_html/includes/modules/pages/advanced_search_result/header_php.php on line 370
The code:
PHP Code:
$rate = $currencies->get_value($_SESSION['currency']);
if ($rate) {
$pfrom = $_GET['pfrom'] / $rate;
$pto = $_GET['pto'] / $rate;
}
I did check on git to see if there were updates on this , but I see no changes.
Should I use a float($rate) ?
Thanks
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
Quote:
Originally Posted by
mesnitu
Code:
[13-Jan-2018 18:24:07 Europe/Lisbon] PHP Warning: A non-numeric value encountered in /home/xxxxxx/public_html/includes/modules/pages/advanced_search_result/header_php.php on line 370
The code:
PHP Code:
$rate = $currencies->get_value($_SESSION['currency']);
if ($rate) {
$pfrom = $_GET['pfrom'] / $rate;
$pto = $_GET['pto'] / $rate;
}
I did check on git to see if there were updates on this , but I see no changes.
Should I use a float($rate) ?
Thanks
Nope, the issue there is that the pfrom/pto values, if not set in the form, come back as '' (a non-numeric value). Try the following instead:
PHP Code:
$rate = $currencies->get_value($_SESSION['currency']);
if ($rate) {
$pfrom = ((float)$_GET['pfrom']) / $rate;
$pto = ((float)$_GET['pto']) / $rate;
}
Re: PHP Warning: A non-numeric value encountered... - PHP 7 warnings
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
Quote:
Originally Posted by
torvista
Line 50 is pretty meaty so I'll leave this for those who seem to enjoy these challenges.......
PHP Code:
$format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(zen_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
I added
if (!is_numeric($number)) $number = 0;
at line 46 in includes/classes/currencies.php
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
Quote:
I added
if (!is_numeric($number)) $number = 0;
at line 46.
....in classes/currencies.php, to clarify.
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
Seen this a couple of times:
[29-May-2018 07:16:10 America/Los_Angeles] PHP Warning: Creating default object from empty value in admin/product.php on line 224
Fix is pretty straightforward - above line 224 in admin/product.php add
if (!is_object($pInfo)) $pInfo = new StdClass();
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
I am having the same error
PHP Warning: A non-numeric value encountered in ..../public_html/includes/classes/categories_ul_generator.php on line 73
Line 73 is
$result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');
Coming from the block code
if (($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
$result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');
}
$result .= $this->child_end_string;
What is the fix for this error?
zen cart 1.5.5f
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
Quote:
Originally Posted by
TamyA
I am having the same error
PHP Warning: A non-numeric value encountered in ..../public_html/includes/classes/categories_ul_generator.php on line 73
Line 73 is
$result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');
Coming from the block code
if (($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
$result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');
}
$result .= $this->child_end_string;
What is the fix for this error?
zen cart 1.5.5f
Change line 58 of the file from:
To:
Code:
$level = (int)$level;
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
Quote:
Originally Posted by
mc12345678
Change line 58 of the file from:
To:
Code:
$level = (int)$level;
Sorry, more than likely will need to add the above at or around line 58 so that $level will be forced to be an integer. In newer php versions it is/will be possible to cast/expect the value to be an integer, but to maintain the existing backwards compatibility the above was the way chosen.