Zen Cart Logo
Forums / Bug Reports / [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

[Done v1.5.5] PHP 5.4 warnings: Illegal string offset

Locked

Views: 51,068

Results 21 to 39 of 39
This thread is locked. New replies are disabled.
14 Nov 2013, 1:39 PM
#21
woodymon avatar

woodymon

Totally Zenned

Join Date:
Sep 2004
Posts:
2,309
Plugin Contributions:
1

[Done v1.5.5] PHP 5.4 warnings: Illegal string offset

Assuming there were no other code change dependencies in play,
I tested the new code in the two github links posted above on a a ZC 1.51 shop:

  1. RE: https://github.com/zencart/zencart/commit/274f4857062bd6df6cc73286272cb78fc86946c9

Tested the code changes in twelve files on above github page

After editing the twelve files, added virtual download products to shopping cart, then clicked "Go to Checkout", then observed the following error:

https://domainname/shop/index.php?main_page=checkout_shipping

Error in Firefox: "The page isn't redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete. This problem can sometimes be caused by disabling or refusing to accept cookies."

I ensured Firefox was not blocking cookies, and indeed, checking out with download products in the cart worked before updating the twelve files. I observe the same result in IE.

Had no issue checking out with physical products.

  1. In regards to the file update for tpl_checkout_shipping_default.php

The github change code for the above file shows "$checked = FALSE;" as a pre-existing line of code.

// set the radio button to be checked if it is the method chosen
$checked = FALSE;

however, this line does not already appear in the zc 1.51 stock file.

And yet github does not show the line of code "$checked = FALSE;" as new
(not displayed in green with a "+" symbol) indicating it should be added.

I went ahead added that code line.

  1. Re: https://github.com/zencart/zencart/commit/8f47bc47bdf6c8a189f51d00e26deb80026d2886

Employed the code changes in /includes/functions/sessions.php

Following that, I observed the sessionid (zenid) was no longer appended to the shop URL while navigating through the shop (and user tracking mod logs showed the same).

Observed no related error or warnings in either the server error log or zc logs.

Reverting to the stock sessions.php, zenid was again employed.

14 Nov 2013, 7:16 PM
#22
vanhorn_s avatar

vanhorn_s

Zen Follower

Join Date:
Apr 2010
Posts:
283
Plugin Contributions:
0

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

My understanding, is that the two github posts, are the changes made to 1.6.0, not the changes that we need to make to 1.5.0, or 1.5.1
I made the changes discussed in the posts here, and that is what worked. I am still running 1.5.0

5 Dec 2013, 3:21 AM
#23
vanhorn_s avatar

vanhorn_s

Zen Follower

Join Date:
Apr 2010
Posts:
283
Plugin Contributions:
0

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

I made all of the file changes discussed on the first page, and I am now getting this error again:
[04-Dec-2013 15:49:10 America/Denver] PHP Warning: Illegal string offset 'cost' in /home2/redsauto/public_html/includes/classes/order.php on line 355
There are only 3 of these in my cache, when I have had 19 orders since I switched to php 5.4
How do I determine what is setting this error now, being that it is such a low occurrence?

5 Dec 2013, 11:51 AM
#24
lat9 avatar

lat9

Administrator

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

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

vanhorn_s:

I made all of the file changes discussed on the first page, and I am now getting this error again:
[04-Dec-2013 15:49:10 America/Denver] PHP Warning: Illegal string offset 'cost' in /home2/redsauto/public_html/includes/classes/order.php on line 355
There are only 3 of these in my cache, when I have had 19 orders since I switched to php 5.4
How do I determine what is setting this error now, being that it is such a low occurrence?
Of the 19 orders, were 3 of them using a different shipping method?

5 Dec 2013, 1:32 PM
#25
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

lat9 some of my client are still getting lots of error logs to after making all the changes. I'm not sure about the shipping method. Any ideas

5 Dec 2013, 2:35 PM
#26
lat9 avatar

lat9

Administrator

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

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

countrycharm: Which changes are "all the changes"?

5 Dec 2013, 2:53 PM
#28
vanhorn_s avatar

vanhorn_s

Zen Follower

Join Date:
Apr 2010
Posts:
283
Plugin Contributions:
0

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

lat9:

Of the 19 orders, were 3 of them using a different shipping method?
They have all been USPS

5 Dec 2013, 5:21 PM
#29
lat9 avatar

lat9

Administrator

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

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

The changes made for Zen Cart v1.5.2 were much more "intense" that those that I proposed in this thread. Please see https://github.com/zencart/zencart/commit/274f4857062bd6df6cc73286272cb78fc86946c9 for the full set of changes made to v1.5.2 surrounding this issue.

19 Dec 2013, 5:08 PM
#30
rayw1679 avatar

rayw1679

Zen Follower

Join Date:
Mar 2005
Location:
Waxahachie, Texas
Posts:
172
Plugin Contributions:
0

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

What is the impact of this error? Does it prevent the order from being completed, or just have the possibility of incorrect data? (We use flat-rate shipping, so we shouldn't be invoking any special calculations; however, we've had 10 of these errors within the past 2 months.) The fix appears extensive, and I don't want to break my store applying the fix (I'm good at that) if it's not a severe problem.

22 Dec 2013, 5:49 PM
#31
vanhorn_s avatar

vanhorn_s

Zen Follower

Join Date:
Apr 2010
Posts:
283
Plugin Contributions:
0

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

rayw1679:

What is the impact of this error? Does it prevent the order from being completed, or just have the possibility of incorrect data? (We use flat-rate shipping, so we shouldn't be invoking any special calculations; however, we've had 10 of these errors within the past 2 months.) The fix appears extensive, and I don't want to break my store applying the fix (I'm good at that) if it's not a severe problem.

I haven't done the extensive fix yet, but what I will do, is backup the files first, make the changes, then upload. If there is a problem, I will go right back to my backup files.

I have had this error show up when there was no order, so it could be affecting sales.

26 Dec 2013, 10:35 PM
#32
rayw1679 avatar

rayw1679

Zen Follower

Join Date:
Mar 2005
Location:
Waxahachie, Texas
Posts:
172
Plugin Contributions:
0

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

Thank you.

6 Feb 2014, 10:24 AM
#33
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

lat9:

The changes made for Zen Cart v1.5.2 were much more "intense" that those that I proposed in this thread. Please see https://github.com/zencart/zencart/commit/274f4857062bd6df6cc73286272cb78fc86946c9 for the full set of changes made to v1.5.2 surrounding this issue.

So running Zen Cart v1.5.1, PHP 5.4

I made all of these changes and initially orders were going to a blank page upon confirmation.. I checked the error logs and I got errors about missing columns.. So I removed all the modified the blocks in the /includes/classes/order.php file which referred to these missing columns..

After that no more PHP 5.4 errors..

21 Feb 2014, 9:40 PM
#34
buildingblocks avatar

buildingblocks

Totally Zenned

Join Date:
Jun 2008
Posts:
629
Plugin Contributions:
0

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

DrByte:

The following changes are incorporated into the next ZC version to handle the errors reported in this thread:

https://github.com/zencart/zencart/commit/274f4857062bd6df6cc73286272cb78fc86946c9

https://github.com/zencart/zencart/commit/8f47bc47bdf6c8a189f51d00e26deb80026d2886

DrByte

I am trying to get the posted fixes on this thread to work on a 1.5.1 cart with php 5.4. The errors still persist. I was going back over the files I worked on comparing to the posted fixes to see if I made a mistake. Looking at the order.php file and comparing to the github link

https://github.com/zencart/zencart/commit/274f4857062bd6df6cc73286272cb78fc86946c9

and also this thread

http://www.zen-cart.com/showthread.php?210291-PHP-5-4-12-PHP-Warning-Illegal-string-offset-cost

I noticed a difference in line 368 + on github

'shipping_cost' => isset($_SESSION['shipping']['cost']) ? $_SESSION['shipping']['cost'] : 0,

and thread 210291

'shipping_cost' => (isset($_SESSION['shipping']['cost']) ? $_SESSION['shipping']['cost'] : 0), 

which would be correct?

22 Feb 2014, 12:38 PM
#35
lat9 avatar

lat9

Administrator

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

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

Use the one on github; the one from the thread contains unnecessary parentheses.

22 Feb 2014, 10:11 PM
#36
buildingblocks avatar

buildingblocks

Totally Zenned

Join Date:
Jun 2008
Posts:
629
Plugin Contributions:
0

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

lat9:

Use the one on github; the one from the thread contains unnecessary parentheses.

Thanks for that.

I started from the beginning and uploaded just the patched /includes/classes/order.php file. The error message for the order.php file is gone now but was still getting

Warning: Illegal string offset 'id' in /home1/xxx/public_html/includes/modules/order_total/ot_shipping.php on line 41
Warning: Illegal string offset 'id' in /home1/xxx/public_html/includes/classes/shipping.php on line 32

(both of the above are unmodified files)

next I applied the patch to /includes/modules/order_total/ot_shipping.php on line 77

That left me with these latest errors

Warning: Illegal string offset 'id' in /home1/xxx/public_html/includes/modules/order_total/ot_shipping.php on line 41

Warning: Illegal string offset 'id' in /home1/xxx/public_html/includes/modules/order_total/ot_shipping.php on line 77

Warning: Illegal string offset 'id' in /home1/xxx/public_html/includes/classes/shipping.php on line 32

I went ahead with the patches for

/includes/modules/pages/checkout_shipping/header_php.php, starting around line 70:
/includes/modules/pages/checkout_payment/header_php.php (line 36):
/includes/modules/pages/checkout_confirmation/header_php.php (line 43):

didn't help. still getting the latest errors.

Because you didn't include the /includes/classes/order.php in your patches I tried restoring the order.php file to original and that brought back the orders error again. I put the patched file back again and am back to the latest 3 errors.

any ideas?

15 Mar 2014, 6:30 AM
#37
jwaynehinkle avatar

jwaynehinkle

New Zenner

Join Date:
Aug 2013
Location:
United States
Posts:
73
Plugin Contributions:
0

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

I just noticed this error today too, does anyone know if this affects whether or not a customer can checkout, I just now noticed it for the first time this morning.

23 Dec 2015, 3:10 PM
#38
marton_1 avatar

marton_1

Totally Zenned

Join Date:
Apr 2013
Location:
eglisau switzerland
Posts:
568
Plugin Contributions:
0

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

I have this error;
3-Dec-2015 13:04:29 Europe/Zurich] PHP Warning: Illegal string offset 'id' in ....../catalog/includes/modules/payment/paypalwpp.php on line 200.

Showed up 4 times starting at 12,00 and so far the error shown is the last one.

Strange thing is nobody has used Paypal so far today on my site so what is triggering paypalwpp.php?
No Paypal error messages.

I am using v1.5.1 with the classic template

Anybody have an idea could be causing this?

28 Dec 2015, 10:13 PM
#39
drbyte avatar

drbyte

Sensei

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

Re: [Done v1.5.5] PHP 5.4 warnings: Illegal string offset

marton_1:

Strange thing is nobody has used Paypal so far today on my site so what is triggering paypalwpp.php?Perhaps they "started" checkout but didn't complete ... hence no evidence of completing purchases yet.
marton_1:

I have this error;
3-Dec-2015 13:04:29 Europe/Zurich] PHP Warning: Illegal string offset 'id' in ....../catalog/includes/modules/payment/paypalwpp.php on line 200.

...

I am using v1.5.1 with the classic template

Anybody have an idea could be causing this?

Yes. ZC v1.5.1 is not compatible with PHP 5.4, and one of the symptoms of that is about 50 things that can trigger "Illegal string offset" errors.
Ref: https://www.zen-cart.com/content.php?48-what-are-the-server-requirements-to-run-zen-cart

You need to upgrade.