Magento 1 problems with PHP 7

882 Views Asked by At

When I try to use Magento 1.x with PHP 7 I am facing these two problems.

Issue 1 :

Can not convert array to string in : app/code/core/Mage/Core/Model/Layout.php

Issue 2 (While login at admin) :

Decoding failed: Syntax error app/code/core/Mage/Core/Helper/Data.php(663): Zend_Json::decode('''', 1)
1

There are 1 best solutions below

1
On BEST ANSWER

There are two solution for it

1) Use Inchoo_PHP7 module (https://github.com/Inchoo/Inchoo_PHP7) but i have noticed in my some projects it makes issue for the cart discount.

2) Handle the issues individually.

Issue 1 Solution:

in app/code/core/Mage/Core/Model/Layout.php at Line 555

$out .= $this->getBlock($callback[0])->$callback[1]();

to

$out .= $this->getBlock($callback[0])->{$callback[1]}();

Issue 2 solution:

in app/code/core/Mage/Core/Helper/Data.php at Line 659

return Zend_Json::decode($encodedValue, $objectDecodeType);

change to

return Zend_Json::decode($objectDecodeType);

I hope it will save your time. Please vote me if it will help you. Thank you very much.