Bug #69124 [Opn->Csd]: Method name must be a string ... triggered by a string

From: Date: Thu, 26 Feb 2015 13:22:01 +0000
Subject: Bug #69124 [Opn->Csd]: Method name must be a string ... triggered by a string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190960@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69124&edit=1 ID: 69124 Updated by: bwoebi@php.net Reported by: narf at devilix dot net Summary: Method name must be a string ... triggered by a string -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: Linux PHP Version: master-Git-2015-02-26 (Git) Block user comment: N Private report: N New Comment: Automatic comment on behalf of bobwei9@hotmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=4b861bde47a4e1294512ba025cf6f1795bb9a1a5 Log: Fixed bug #69124 (method name could not be used when by ref) Previous Comments: ------------------------------------------------------------------------ [2015-02-26 09:14:36] narf at devilix dot net Description: ------------ $this->{$method}() calls fail with a "Method name must be a string" error, even if $method is a string (and an existing method too). I've encountered this after assigning $method via sscanf(), so it might be a sscanf() issue, but it doesn't look like it ... Test script: --------------- <?php class Foo { public function test() { sscanf('bar', '%s', $method); var_dump($method); $this->{$method}(); } public function bar() {} } $bar = new Foo(); $bar->test(); Expected result: ---------------- string(3) "bar" Actual result: -------------- string(3) "bar" Fatal error: Method name must be a string in %s on line 8 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69124&edit=1

« previous php.bugs (#190960) next »