Bug #68172 [Opn]: Function name must be a string
| From: | sixd@php.net | Date: | Tue, 07 Oct 2014 03:35:48 +0000 |
| Subject: | Bug #68172 [Opn]: Function name must be a string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187908@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68172&edit=1
ID: 68172
Updated by: sixd@php.net
Reported by: pegasus at vaultwiki dot org
Summary: Function name must be a string
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: Centos 6 64-bit
PHP Version: master-Git-2014-10-07 (Git)
Block user comment: N
Private report: N
New Comment:
See https://wiki.php.net/rfc/uniform_variable_syntax
Previous Comments:
------------------------------------------------------------------------
[2014-10-07 03:00:48] pegasus at vaultwiki dot org
Description:
------------
Assuming an object scope, where $info['callback'] = 'callbackMethod' and
'callbackMethod' is a method on $this object.
The following code works under 5.6.0:
####
$out = $this->$info['callback']($data);
####
But in Master it throws a fatal error (Function name must be a string).
Changing it to the following and it again works as expected:
####
$out = $this->{$info['callback']}($data);
####
Unfortunately this code is from another vendor, so I cannot expect them to change this although
using curly braces may be better practice in general to specify the proper evaluation order.
Expected result:
----------------
No fatal error.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68172&edit=1