Forums / General Questions / PHP Warning: Illegal offset type

PHP Warning: Illegal offset type

Views: 1,275

Results 1 to 4 of 4
20 Aug 2015, 5:30 PM
#1
soxophoneplayer avatar

soxophoneplayer

Totally Zenned

Join Date:
Feb 2008
Posts:
534
Plugin Contributions:
0

PHP Warning: Illegal offset type

I'm get this error in my log most days, sometimes twice. Can't figure out what's up.

[23-Jul-2015 15:47:54 America/New_York] PHP Warning: Illegal offset type in /home/***/public_html/includes/modules/shipping_estimator.php on line 132

The code in that area is:
```
// set the cost to be able to calculate free shipping
$order->info = array('total' => $_SESSION['cart']->show_total(), // TAX ????
'currency' => $currency,
'currency_value'=> $currencies->currencies[$currency]['value']);


I use winchester_black responsive template; Canada Post shipping mod is only shipping mod I use and it doesn't modify this file; My default currency is CAN$ and my site is CDN but my server is US.

Thanks,
site is meafordwool  dot com
21 Aug 2015, 12:57 AM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: PHP Warning: Illegal offset type

soxophoneplayer:

I'm get this error in my log most days, sometimes twice. Can't figure out what's up.
[23-Jul-2015 15:47:54 America/New_York] PHP Warning: Illegal offset type in /home/*/public_html/includes/modules/shipping_estimator.php on line 132

This is a known problem in ZenCart V1.5.0/V1.5.1 and a very similar problem was also popping up in several other modules. At the end of the day the issue was traced back to changes made in PHP 5.4.

As I recall, these are/were 'harmless' warnings that didn't affect functionality in any way.

The problems that caused them were taken care of in ZenCart V1.5.4.

This suggests that if you ARE using V1.5.4 then you didn't do a complete/full upgrade and some of your files are from an older version of zencart.

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

21 Aug 2015, 3:47 PM
#3
soxophoneplayer avatar

soxophoneplayer

Totally Zenned

Join Date:
Feb 2008
Posts:
534
Plugin Contributions:
0

Re: PHP Warning: Illegal offset type

RodG:

...This suggests that if you ARE using V1.5.4 then you didn't do a complete/full upgrade and some of your files are from an older version of zencart.

Cheers
RodG

Thank you for reply.

This was a clean build with zc 1.5.4. My old 1.3.9 would have been too onerous to update so I started from scratch, with zc clean files and also all mods from scratch. Mods include: winchester_black repsonsive template, Canada Post, Stock by Attrib (github vs for 1.5.4), IH4, Flex Lang/Currencies Header, CKeditor4.5.2, Google Analytics, EZPages Metatags, and Sales Report.

I use Firebug but haven't had any success adding an ext to let me check files for php errors, particuarly to through the mod files if core files are clean. Can you recommend a resource I can use to check php? I am not a coder; pretty much a monkey-see monkey-do guy.

I realize it may be a non problem, but I get jittery when I open the log file to a humongous list of error messages ;o)

22 Aug 2015, 2:24 AM
#4
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: PHP Warning: Illegal offset type

soxophoneplayer:

This was a clean build with zc 1.5.4. My old 1.3.9 would have been too onerous to update so I started from scratch, with zc clean files and also all mods from scratch. Mods include: winchester_black repsonsive template, Canada Post, Stock by Attrib (github vs for 1.5.4), IH4, Flex Lang/Currencies Header, CKeditor4.5.2, Google Analytics, EZPages Metatags, and Sales Report.

If I were to take a gamble, I'd say that the problem is most likely to be related to the Flex Lang/Currencies Header add-on.
I'm not familiar with this particular addon, but the error message you are getting suggests that it could well be currency related.

soxophoneplayer:

I use Firebug but haven't had any success adding an ext to let me check files for php errors,

I don't think such an extension could exist - Firefox (in fact all web browsers) can/will only 'see' the HTML output created by the PHP code, not the code itself.

soxophoneplayer:

Can you recommend a resource I can use to check php? I am not a coder; pretty much a monkey-see monkey-do guy.

I'm a great fan of NetBeans. There are several other really great IDE's available though.

Unless you can narrow down or isolate the problem by trial and error you'll need an IDE (Integrated Development system) to find the cause, as these tools allow you to step through the PHP code line by line. They can be quite daunting if you've never used one before though.

soxophoneplayer:

I realize it may be a non problem, but I get jittery when I open the log file to a humongous list of error messages ;o)

Me too. Although PHP warnings generally are a non issue - it is usually just a matter of time (a future PHP upgrade) where these warnings become actual errors - and PHP errors tend to be 'fatal'.

Other than the suggestion to use an IDE to identify the problem, there are a couple of important things to keep in mind.

  1. The 'native' code for ZenCart V1.5.4 doesn't have this problem, so with a clean install you can ignore this as a possible cause (as well as my previous suggestion about not all files were updated).

  2. Based on item#1, the problem can only be caused by one of your add-ons.

On this basis, MY approach would be to disable/remove the mostly likely add-ons until the problem goes away, as that will identify the culprit. From there it is often a simple matter of identifying the actual cause of the error/warning.

Based on the file and line that is reporting the problem (shipping_estimator.php on line 132) I'd say:

Mods include:
winchester_black repsonsive template: Unlikely
Canada Post: Possibe but unlikely because this is a very popular/well used add-on (other would surely have the same issue)
Stock by Attrib (github vs for 1.5.4): I couldn't imagine how - Discount this
IH4: I couldn't imagine how - Discount this
Flex Lang/Currencies Header: My prime suspect
CKeditor4.5.2, Google Analytics, EZPages Metatags, and Sales Report.: I couldn't imagine how - Discount these.

In short, until proven otherwise, I'm going to suggest it has something to do with the Flex Lang/Currencies Header.

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.