Re: PHP Warning: A non-numeric value encountered... categories_ul_generator.php
Quote:
Originally Posted by
carlwhat
..... so i would recommend applying them both.
Yep, did just that.
Quote:
Originally Posted by
carlwhat
i find @torvista s work solid and agree with most things he brings up; certainly in this case, it does address your issue....
best.
Absolutely, fully agree hence I had no hesitation applying his suggestion.
Cheers
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
Scenario:
start to add a new product
select "Product Priced by Attributes: - Yes"
Leave price blank/0
Other fields do not matter.
Insert product.
Debug log generated:
Quote:
[11-Dec-2017 17:17:48 Europe/Madrid] Request URI: /zc155e_vanilla/admin1/product.php?cPath=1_17&product_type=1&pID=183&action=new_product_preview&page=1, IP address: 127.0.0.1
#1 currencies->format() called at blah-blah\public_html\zc155e_vanilla\admin1\includes\modules\product\preview_info.php :56]
#2 require(blah-blah\public_html\zc155e_vanilla\admin1\includes\modules\product\preview_info.php ) called at [blah-blah\public_html\zc155e_vanilla\admin1\product.php:145]
[11-Dec-2017 17:17:48 Europe/Madrid] PHP Warning: A non-numeric value encountered in blah-blah\public_html\zc155e_vanilla\includes\classes\currencies.php on line 50
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'];
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
Quote:
Originally Posted by
torvista
Scenario:
start to add a new product
select "Product Priced by Attributes: - Yes"
Leave price blank/0
Other fields do not matter.
Insert product.
Debug log generated:
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'];
The "Product Priced by Attributes" setting is a red-herring and doesn't matter; the root cause of the debug-log is the fact that the product's price is not entered so it's an empty string ('') and thus non-numeric so that PHP 7.0+'s variable-type-checking steps in.
/admin/includes/modules/product/preview_info.php should ensure that the price value supplied to the currency class is numeric, i.e. an update to line 56 of that file from the ZC 1.5.5e distribution:
Code:
<td class="pageHeading" align="right"><?php echo $currencies->format((float)$pInfo->products_price) . ($pInfo->products_virtual == 1 ? '<span class="errorText">' . '<br />' . TEXT_VIRTUAL_PREVIEW . '</span>' : '') . ($pInfo->product_is_always_free_shipping == 1 ? '<span class="errorText">' . '<br />' . TEXT_FREE_SHIPPING_PREVIEW . '</span>' : '') . ($pInfo->products_priced_by_attribute == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_PRICED_BY_ATTRIBUTES_PREVIEW . '</span>' : '') . ($pInfo->product_is_free == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_IS_FREE_PREVIEW . '</span>' : '') . ($pInfo->product_is_call == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_IS_CALL_PREVIEW . '</span>' : '') . ($pInfo->products_qty_box_status == 0 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_QTY_BOX_STATUS_PREVIEW . '</span>' : '') . ($pInfo->products_priced_by_attribute == 1 ? '<br />' . zen_get_products_display_price($_GET['pID']) : ''); ?></td>
I'll note that the issue remains on the current ZC 1.5.6 repository.
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
That was easy.. (for me)!
Thanks!
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
Hi
I'm getting this warnings with 7.1
I did fix the categories_ul_generator with (int) .... now I was about to fix the taxes, and I understood I could be here doing this all day, so I search for a solution in the forum.
But I see the use of (float) also.... plus the github fix for taxes
Does the zc 1.55f fix this issues , or if not , is it "safer" to use float where ever I get this warnings ?
Thanks
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
PHP 7.2 support is NOT built-in to v1.5.5f.
But here's a list of the changes required to adapt it: https://github.com/zencart/zencart/pull/1582/files
All of these ARE built-in to v1.5.6
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
One other issue that I'm facing is :
Code:
Uncaught Error: Cannot use string offset as an array in /home/xxx/public_html/includes/modules/tpl_pb/category_row.php:39
But, this Error only occurs in the online server with 7.1.13
On my local xampp 7.1.12 it doesn't
This is one, another it's driving me crazy, because it works in my local machine and it doesn't on the online server, and I even don't know what to ask...
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
Code:
Uncaught Error: Cannot use string offset as an array in /home/xxx/public_html/includes/modules/tpl_pb/category_row.php:39
After all it does occur in my local machine, but it's related to breadcrumb. And I've update php to 7, zencart to 155f, Ceon URI to php7, and now I'm lost.
Big mistake.
But probably it's related to CEON.... or not.
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
Quote:
Originally Posted by
mesnitu
Code:
Uncaught Error: Cannot use string offset as an array in /home/xxx/public_html/includes/modules/tpl_pb/category_row.php:39
After all it does occur in my local machine, but it's related to breadcrumb. And I've update php to 7, zencart to 155f, Ceon URI to php7, and now I'm lost.
Big mistake.
But probably it's related to CEON.... or not.
The Ceon URI Mapping that has been updated to support php 7 addresses the breadcrumb issue and this error has not otherwise been seen. The fact that this file is in a template override directory implies it has been modified in some way to support the template (not a modification made by Ceon URI Mapping), so it would make more sense to provide the code at, around, and before line 39 to try to identify what modification has been made to cause an attempt to use a string offset as an array.
Re: PHP Warning: A non-numeric value encountered... admin, currencies.php
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 !