This question already has an answer here:

Magento 1.9.4 not run with PHP 7, it showing error as below:

Fatal error: Uncaught Error: Function name must be a string in 
app\code\core\Mage\Core\Model\Layout.php:555 Stack trace: #0 
app\code\core\Mage\Core\Controller\Varien\Action.php(390): Mage_Core_Model_Layout->getOutput() #1 
app\code\core\Mage\Cms\Helper\Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout() #2 
app\code\core\Mage\Cms\Helper\Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home') #3 
app\code\core\Mage\Cms\controllers\IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home') #4 
app\code\core\Mage\Core\Controller\Varien\Action.php(418): Mage_Cms_IndexController->indexAction() #5 
app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index') #6 
app\code\core\Mage\Core\Model\Layout.php on line 555

marked as duplicate by Raphael at Digital Pianism, Qaisar Satti, Fabian Schmengler, Anna Völkl, mbalparda Mar 10 '16 at 14:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @magenX It is my real project problem issue , i try to find out existing question that are not appropriate solution for my problem. At last i submit my real problem & get appropriate solution. If you think it duplicate you may marge it. But still i think my question is my real problem & may also unique . If you programmer please compare problem expaination not similar type heading titile – matinict Mar 10 '16 at 9:27
  • 2
    if you are developer then probably the first thing you need to read is the minimum system requirements... your question was answered 7 months ago -> – MagenX Mar 10 '16 at 10:36
  • The linked question has an answer to your specific problem, if you scroll down a bit: – Fabian Schmengler Mar 10 '16 at 10:36
  • @magenX answered 7 months but php7 release 4month ago – matinict Mar 10 '16 at 10:47
  • OMG, what exactly we arguing here??? php 7 was released in 11 Jun 2015 ... Zsolti already answered your question, for gods sake... LOL – MagenX Mar 10 '16 at 10:55
up vote 59 down vote accepted

It happens because in PHP 7 you need to clarify that you are going to call the $callback variable as a method (function). So, the original line of the code looks like the following (file app/code/core/Mage/Core/Model/Layout.php):

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

In order to make it work on the latest PHP version we need to replace this piece of code by this one:

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

Refer this blog for further information.

  • May i know the diff b/w, with braces or without braces means. – zus Mar 13 at 5:07

If you want to run your Magento 1.x website on PHP7, you need to make some little tweaks in your some Magento 1.x files to make it work without any issues.

Most of Magento code is still valid in PHP 7, there are few incompatibilities listed below:

1. Uniform Variable Syntax issues:

1.1 app/code/core/Mage/Core/Model/Layout.php:555

This file causes and fatal error which crashes Magento. Override the file and replace

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


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

1.2 app\code\core\Mage\ImportExport\Model\Import\Uploader.php:135

This file effects Magento CSV importer. Override the file, then override _validateFile() function and replace the line 135 with replace




1.3 app\code\core\Mage\ImportExport\Model\Export\Entity\Product\Type\Abstract.php:99

This issue effect export functionality of Magento. Magento extends three classes from above abstract class, so root cause of error inside below class is the line#99 in above class.

Mage_ImportExport_Model_Export_Entity_Product_Type_Configurable Mage_ImportExport_Model_Export_Entity_Product_Type_Grouped Mage_ImportExport_Model_Export_Entity_Product_Type_Simple

We need to override above three classes in our local code pool and override overrideAttribute() function, replace line#99

$data['filter_options'] = $this->$data['options_method']();


$data['filter_options'] = $this->{$data['options_method']}();

1.4 app\code\core\Mage\ImportExport\Model\Export\Entity\Customer.php:250

This file effects export customers functionality. Override above file and change the line#250 as shown below

$data['filter_options'] = $this->$data['options_method']();


$data['filter_options'] = $this->{$data['options_method']}();

1.5 lib\Varien\File\Uploader.php:259

File uploading will not work. Magento extends Mage_Core_Model_File_Uploader from above class, so we need to override this class and rewrite _validateFile() function replace below line




2. Type casting Issue

2.1 app\code\core\Mage\Core\Model\Resource\Session.php:218

Magento Sessions don’t work on PHP 7, so as a result user login doesn’t work. read($sessId) function should return a string so typecast the return variable as given below

return $data;


return (string)$data;

3. Incorrect Grand Total

Incorrect totals are due to wrong sort order of subtotal, discount, shipping etc Correct the sort order by creating an extension and put below code in config.xml of the extension


Here is the original reference to what I posted above:

If you cannot find any query in your code, so this will be covered by Magento and as I said before, most of the code is valid so you may just ignore it. I believe thats all can answer your question.

Not the answer you're looking for? Browse other questions tagged or ask your own question.