Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Illegal offset type - advice needed.


pvtparts

Recommended Posts

I'm having some trouble with "Illegal Offset Type" errors every now and again (not constant). It seems that I'm getting them when viewing 'who's online' but apparently, customers have seen them on our live site so I'll be for the high-jump if I can't fix it. :'(

 

I'll have to warn you, I'm a php 'fixer' I can't write a coherent program but I get just enough of the logic to fix some broken things but often, like now, I desperately need help.

 

The error appears as follows:

 

Warning: Illegal offset type in /path/to/webroot/admin/includes/classes/currencies.php on line 37
Warning: Illegal offset type in /path/to/webroot/admin/includes/classes/currencies.php on line 38
Warning: Illegal offset type in /path/to/webroot/admin/includes/classes/currencies.php on line 38
Warning: Illegal offset type in /path/to/webroot/admin/includes/classes/currencies.php on line 38
Warning: Illegal offset type in /path/to/webroot/admin/includes/classes/currencies.php on line 38
Warning: Illegal offset type in /path/to/webroot/admin/includes/classes/currencies.php on line 38

 

Now, intriguingly, there is nothing on line 37, however, on line 38 we have:

 

 if (empty($currency_type)) $currency_type = $currency;

 

Now, apparently, if currency_type has for some reason become an array, it will cause this error due to php not allowing an array as a key (I am told).

 

So, I cobbled together the following to identify if currency_type is an array and, if so, convert it to a string (from looking at other people's workarounds with other software)

 

I inserted this above line 38

 

 if (is_array($currency_type)) {$currency_type = $currency_type[0];}

 

^Is that safe? Is it even the right way of doing it?

Link to comment
Share on other sites

I think you have uploaded your catalog/includes/classes/currencies.php into admin, put the correct one in there and see if the "Warning" goes away. Then check your error level setting in application_top. You really shouldn't show any php messages to your customers.

Link to comment
Share on other sites

I think you have uploaded your catalog/includes/classes/currencies.php into admin, put the correct one in there and see if the "Warning" goes away. Then check your error level setting in application_top. You really shouldn't show any php messages to your customers.

 

I currently have:

 

 error_reporting(E_ALL & ~E_NOTICE);

 

In my catalog application_top.php

 

What should this be set to for a production shop?

Link to comment
Share on other sites

error_reporting(E_ALL & ~E_NOTICE); this is ok.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

paste the line that is prior to line 38 but has some code in it.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...