Zen Cart Logo
Forums / General Questions / Illegal string offset 'id' in order.php

Illegal string offset 'id' in order.php

Views: 8,464

Results 1 to 17 of 17
13 Jul 2015, 11:00 PM
#1
marcopolo avatar

marcopolo

Totally Zenned

Join Date:
May 2008
Location:
United States
Posts:
520
Plugin Contributions:
2

Illegal string offset 'id' in order.php

I'm getting the following error message:
Illegal string offset 'id' in order.php

Here is the line it does not like:

      if (STORE_PRODUCT_TAX_BASIS == 'Shipping' && stristr($_SESSION['shipping']['id'], 'storepickup') == TRUE) 

Server details:
Zencart 1.5.4
MySQL 5.6.24
5.6.8-1

Is this a bug?

13 Jul 2015, 11:13 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,091
Plugin Contributions:
56

Re: Illegal string offset 'id' in order.php

A post that contains the full debug log (especially if augmented by the myDEBUG Backtrace plugin) would help. Starting in v1.5.3, the $_SESSION['shipping'] variable went through an overhaul to remove PHP warnings like you posted.

A list of your installed plugins would also be helpful.

13 Jul 2015, 11:16 PM
#3
marcopolo avatar

marcopolo

Totally Zenned

Join Date:
May 2008
Location:
United States
Posts:
520
Plugin Contributions:
2

Re: Illegal string offset 'id' in order.php

Here is the full debug text:
[13-Jul-2015 10:08:27 America/New_York] PHP Warning: Illegal string offset 'id' in /var/www/zencart/includes/classes/order.php on line 472

14 Jul 2015, 1:08 AM
#4
marcopolo avatar

marcopolo

Totally Zenned

Join Date:
May 2008
Location:
United States
Posts:
520
Plugin Contributions:
2

Re: Illegal string offset 'id' in order.php

Without having to list every mod is there anything I can try to fix this?

14 Jul 2015, 2:45 AM
#5
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
970
Plugin Contributions:
0

Re: Illegal string offset 'id' in order.php

ive been getting these errors on and off for a couple of years now, since installing v1.51. i dont see any real problems, i'm still making sales

14 Jul 2015, 3:57 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Illegal string offset 'id' in order.php

marcopolo:

I'm getting the following error message:
Illegal string offset 'id' in order.php

Here is the line it does not like:

  if (STORE_PRODUCT_TAX_BASIS == 'Shipping' && stristr($_SESSION['shipping']['id'], 'storepickup') == TRUE) 
> 
> Server details:
> Zencart 1.5.4
> MySQL 5.6.24
> 5.6.8-1
> 
> Is this a bug?

> **marcopolo:**
>
> Here is the full debug text:
> [13-Jul-2015 10:08:27 America/New_York] PHP Warning:  Illegal string offset 'id' in /var/www/zencart/includes/classes/order.php on line 472
The code you quoted is not from line 472 of ZC v1.5.4. So it appears you're using an old version of that file, or one modified by a plugin but which isn't compatible with v1.5.4
14 Jul 2015, 11:27 PM
#7
marcopolo avatar

marcopolo

Totally Zenned

Join Date:
May 2008
Location:
United States
Posts:
520
Plugin Contributions:
2

Re: Illegal string offset 'id' in order.php

The edits are minimum and more below that line, can I send you the file to look at?

21 Jul 2015, 1:50 AM
#8
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,701
Plugin Contributions:
56

Re: Illegal string offset 'id' in order.php

I believe this is still an issue. Seeing in an unmodified 1.5.4 includes/classes/order.php on line 462 with PHP 5.6.2. I can try with other PHPs if needed.

21 Jul 2015, 10:21 AM
#9
marcopolo avatar

marcopolo

Totally Zenned

Join Date:
May 2008
Location:
United States
Posts:
520
Plugin Contributions:
2

Re: Illegal string offset 'id' in order.php

I was able to resolve the issue by changing:

  ```php

if (STORE_PRODUCT_TAX_BASIS == 'Shipping' && stristr($_SESSION['shipping']['id'], 'storepickup') == TRUE)

to 

     ```php
 if (STORE_PRODUCT_TAX_BASIS == 'Shipping' && isset($_SESSION['shipping']['id']) && stristr($_SESSION['shipping']['id'], 'storepickup') == TRUE) 
21 Jul 2015, 10:32 AM
#10
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Illegal string offset 'id' in order.php

marcopolo:

I was able to resolve the issue by changing:

  ```php

if (STORE_PRODUCT_TAX_BASIS == 'Shipping' && stristr($_SESSION['shipping']['id'], 'storepickup') == TRUE)

> to 
> 
>      ```php
 if (STORE_PRODUCT_TAX_BASIS == 'Shipping' && isset($_SESSION['shipping']['id']) && stristr($_SESSION['shipping']['id'], 'storepickup') == TRUE) 

Perhaps I need to do more research, but it seems to me that this simply fixes the result of a previous problem not the problem that is causing this fix to be needed... I say this partially because I once had to apply a similar fix for a shipping module, but found out it was the shipping module that was not "generated" properly that made this issue appear...

Earlier in this thread it was asked if all modules were needed... If anything I would think those that have an effect on shipping propably would be prudent. :)

21 Jul 2015, 4:34 PM
#11
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,701
Plugin Contributions:
56

Re: Illegal string offset 'id' in order.php

This fixes the symptom but not the cause. I will review the shipping modules in use on this site and post back with my findings.

23 Jul 2015, 10:29 AM
#12
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,701
Plugin Contributions:
56

Re: Illegal string offset 'id' in order.php

I seem to get this error on one particular cart when I change the shipping address from the checkout shipping page (and when I return to the checkout shipping page after having changed the address).

23 Jul 2015, 1:10 PM
#13
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,091
Plugin Contributions:
56

Re: Illegal string offset 'id' in order.php

Hmm, changing the address should/would require that the shipping calculations be redone within the checkout_shipping page's header ...

23 Jul 2015, 1:17 PM
#14
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,701
Plugin Contributions:
56

Re: Illegal string offset 'id' in order.php

I have only seen this on the one cart, but I don't believe it was template related - switching back to classic and was able to duplicate it there too.

23 Jul 2015, 2:09 PM
#15
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,091
Plugin Contributions:
56

Re: Illegal string offset 'id' in order.php

swguy:

I have only seen this on the one cart, but I don't believe it was template related - switching back to classic and was able to duplicate it there too.
That behavior strengthens my previous statement. If it's not in the template, it's in code that runs on all templates ... like /includes/modules/pages/checkout_shipping/header_php.php.

24 Jul 2015, 12:26 AM
#16
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,701
Plugin Contributions:
56

Re: Illegal string offset 'id' in order.php

OK - there were two files that had been modified from 1.5.4:

includes/modules/checkout_new_address.php
includes/modules/pages/checkout_shipping_address/header_php.php

Replacing those seemed to fix this issue.

25 Jul 2015, 3:31 PM
#17
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,701
Plugin Contributions:
56

Re: Illegal string offset 'id' in order.php

I scanned the last few years of mods - this issue might be caused by changes made by Fast & Easy Checkout. No other obvious candidates.