Forums / Bug Reports / [Done v1.5.2] PHP 5.4.12, PHP Warning: Illegal string offset 'cost'

[Done v1.5.2] PHP 5.4.12, PHP Warning: Illegal string offset 'cost'

Locked

Started by gilby on 30 Sep 2013, 9:17 AM · Views: 4,045

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
30 Sep 2013, 9:17 AM
#1
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

[Done v1.5.2] PHP 5.4.12, PHP Warning: Illegal string offset 'cost'

Using PHP 5.4.12 and zen v151
During checkout: Step 1 of 3 - Delivery Information
Click: Change the Address
Change the Shipping Address: add a new address or choose another.
Click: Continue, goes back to Step 1 of 3 - Delivery Information

At this point I get the error:
PHP Warning: Illegal string offset 'cost' in /home/XXXXXXX/public_html/includes/classes/order.php on line 355

Quick temporary fix. Find line 355```php
'shipping_cost' => $_SESSION['shipping']['cost'],

Change to ```php
 'shipping_cost' => (isset($_SESSION['shipping']['cost']) ? $_SESSION['shipping']['cost'] : 0),
30 Sep 2013, 6:39 PM
#2
drbyte avatar

drbyte

Sensei

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

Re: [Done v1.5.2] PHP 5.4.12, PHP Warning: Illegal string offset 'cost'

This is a complicated issue to fix "completely", as these array elements are used in multiple ways, both as strings and as arrays. IIRC this lovely code was inherited from osC.

Discussed more in a previous thread: http://www.zen-cart.com/showthread.php?202319-PHP-5-4-warnings-Illegal-string-offset

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.