|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-02-26 13:22 UTC] bwoebi@php.net
[2015-02-26 13:22 UTC] bwoebi@php.net
-Status: Open
+Status: Closed
[2016-07-20 11:39 UTC] davey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
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