Bug #71170 [Opn->Nab]: function name as array not working

From: Date: Sat, 19 Dec 2015 23:34:27 +0000
Subject: Bug #71170 [Opn->Nab]: function name as array not working
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198050@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71170&edit=1 ID: 71170 Updated by: nikic@php.net Reported by: dallas at ekkysoftware dot com Summary: function name as array not working -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: debian 8 PHP Version: 7.0.1 Block user comment: N Private report: N New Comment: The correct syntax for PHP 7 is $this->getBlock($callback[0])->{$callback[1]}(); See also: https://wiki.php.net/rfc/uniform_variable_syntax Previous Comments: ------------------------------------------------------------------------ [2015-12-19 23:31:49] 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... ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71170&edit=1

« previous php.bugs (#198050) next »