|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-12-19 23:31 UTC] dallas at ekkysoftware dot com
Description:
------------
Function name as an array element not working even though it's a string
Test script:
---------------
if(false){
//In Magento this doesn't work:-
$out .= $this->getBlock($callback[0])->$callback[1]();
//While this does
$str = $callback[1];
$out .= $this->getBlock($callback[0])->$str();
}
Expected result:
----------------
function is to be called
Actual result:
--------------
Throws exception:-
[Sun Dec 20 10:09:53.861694 2015] [:error] [pid 3622:tid 140406412060416] [client 110.174.8.215:55270] FastCGI: server "/opt/php-7.0.1/sbin/php-fpm" stderr: PHP message: PHP Fatal error: Uncaught Error: Function name must be a string in /var/www/www.popcherry.com.au/pcmago14/source/app/code/core/Mage/Core/Model/Layout.php:555
[Sun Dec 20 10:09:53.861764 2015] [:error] [pid 3622:tid 140406412060416] [client 110.174.8.215:55270] FastCGI: server "/opt/php-7.0.1/sbin/php-fpm" stderr: Stack trace:
[Sun Dec 20 10:09:53.861777 2015] [:error] [pid 3622:tid 140406412060416] [client 110.174.8.215:55270] FastCGI: server "/opt/php-7.0.1/sbin/php-fpm" stderr: #0 /var/www/www.popcherry.com.au/pcmago14/source/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
[Sun Dec 20 10:09:53.861786 2015] [:error] [pid 3622:tid 140406412060416] [client 110.174.8.215:55270] FastCGI: server "/opt/php-7.0.1/sbin/php-fpm" stderr: #1 /var/www/www.popcherry.com.au/pcmago14/source/app/code/core/Mage/Cms/Helper/Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout()
[Sun Dec 20 10:09:53.861795 2015] [:error] [pid 3622:tid 140406412060416]
[client 110.174.8.215:55270] FastCGI: server "/opt/php-7.0.1/sbin/php-fpm" stderr: #2 /var/www/www.popcherry.com.au/pcmago14/source/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
[Sun Dec 20 10:09:53.861804 2015] [:error] [pid 3622:tid 140406412060416] [client 110.174.8.215:55270] FastCGI: server "/opt/php-7.0.1/sbin/php-fpm" stderr: #3 /var/www/www.popcherry.com.au/pcmago14/source/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
[Sun Dec 20 10:09:53.861812 2015] [:error] [pid 3622:tid 140406412060416] [client 110.174.8.215:55270] FastCGI: server "/opt/php-7.0.1/sbin/php-fpm" stderr: #4 /var/www/www.popcherry.com.au/pcmago14/source/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->indexAction()
[Sun Dec 20 10:09:53.861821 2015] [:error] [pid 3622:tid 140406412060416] [client 110.174.8.215:55270] FastCGI: server "/opt/php-7.0.1/sbin/php-fpm" stderr: #5 /var/www/www.popcherry.com.au/pcmago14/sou...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 20:00:02 2026 UTC |
The correct syntax for PHP 7 is $this->getBlock($callback[0])->{$callback[1]}(); See also: https://wiki.php.net/rfc/uniform_variable_syntax