Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal error: Uncaught Error: Function name must be a string in C:\xampp\htdocs\em0126\app\code\core\Mage\Core\Model\Layout.php:555 Stack trace: #0

I am facing these errors while accessing Magento folder from XAMPP (localhost/magento):

Fatal error: Uncaught Error: Function name must be a string in C:\xampp\htdocs\em0126\app\code\core\Mage\Core\Model\Layout.php:555 Stack trace: #0 C:\xampp\htdocs\em0126\app\code\core\Mage\Core\Controller\Varien\Action.php(390): Mage_Core_Model_Layout->getOutput() #1 C:\xampp\htdocs\em0126\app\code\core\Mage\Install\controllers\WizardController.php(120): Mage_Core_Controller_Varien_Action->renderLayout() #2 C:\xampp\htdocs\em0126\app\code\core\Mage\Core\Controller\Varien\Action.php(418): Mage_Install_WizardController->beginAction() #3 C:\xampp\htdocs\em0126\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('begin') #4 C:\xampp\htdocs\em0126\app\code\core\Mage\Core\Controller\Varien\Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #5 > C:\xampp\htdocs\em0126\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Controller_Varien_Front->dispatch() #6 C:\xampp\htdocs\em0126\app\Mage.php(683): Mage_Core_Mo in C:\xampp\htdocs\em0126\app\code\core\Mage\Core\Model\Layout.php on line 555

like image 738
Sher Ali Avatar asked Feb 24 '16 19:02

Sher Ali


4 Answers

Your solution

Fatal error: Uncaught Error: Function name must be a string in ... app\code\core\Mage\Core\Model\Layout.php:555 ...

This error was easy to fix because the problem was in the following line:

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

Instead it should be:

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

find your detail solution here on below given link http://www.code007.ro/making-work-magento-with-php-7-rc1/

like image 145
Abhishek Baranwal Avatar answered Nov 10 '22 21:11

Abhishek Baranwal


Its due to PHP7

It's not recommended to edit the core file. We will override it.

Copy this file app/code/core/Mage/Core/Model/Layout.php into app/code/local/Mage/Core/Model/Layout.php

Change code in app/code/local/Mage/Core/Model/Layout.php file (line # 555)

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

To:

$out .= $this->getBlock($callback[0])->{$callback[1]}();
like image 41
Nadeem0035 Avatar answered Nov 10 '22 22:11

Nadeem0035


Changed the line 555 to:

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

It works. But one thing I'm not sure of if this is really a php7. I'm running this on my website with same files and configurations on the same server and it's working with no issues without changing that line.

like image 20
MsC Avatar answered Nov 10 '22 20:11

MsC


Go to app\code\core\Mage\Core\Model\Layout.php line no 555 and

 change $callback[1] to {$callback[1]}
like image 12
Pankaj Upadhyay Avatar answered Nov 10 '22 22:11

Pankaj Upadhyay