Skip to content

Instantly share code, notes, and snippets.

@WaximeA
Last active November 22, 2018 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WaximeA/c4e2dfff406b9ba3ca747917b9a6528b to your computer and use it in GitHub Desktop.
Save WaximeA/c4e2dfff406b9ba3ca747917b9a6528b to your computer and use it in GitHub Desktop.
Fix Magento PHP 7.X Fatal error

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment