php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68172 Function name must be a string
Submitted: 2014-10-07 03:00 UTC Modified: 2014-10-07 12:50 UTC
From: pegasus at vaultwiki dot org Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: master-Git-2014-10-07 (Git) OS: Centos 6 64-bit
Private report: No CVE-ID: None
 [2014-10-07 03:00 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-07 04:25 UTC] pegasus at vaultwiki dot org
I can accept that vBulletin 4 will not be usable with the next iteration of PHP using vBulletin's official distro (I doubt they are updating that branch anymore). It was easy enough to modify the source on my installation, so it's not an issue for me. Hopefully others won't be caught off-guard by this issue.
 [2014-10-07 12:50 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2014-10-07 12:50 UTC] nikic@php.net
As sixd pointed out, this is an intentional BC break. I'll probably provide tooling for automatically finding and fixing issues like these.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 15:01:31 2024 UTC