|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-09-29 04:03 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2016-09-29 04:03 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 09:00:02 2026 UTC |
Description: ------------ until 5.6.26, I can call a method for a object in the below form which the $value is a method in the class: $objName->$arrName[$key](); but from 7.0, I got error message like: PHP Notice: Array to string conversion in /home/xxx/test.php on line 12 PHP Notice: Undefined property: TestClass::$Array in /home/xxx/test.php on line 12 PHP Fatal error: Uncaught Error: Function name must be a string in /home/xxx/test.php:12 Stack trace: #0 {main} thrown in /home/xxx/test.php on line 12 Test script: --------------- <?php class TestClass{ function testFunc() { echo "a\n"; } } $funcs = array( "a" => "testFunc"); $testObject = new TestClass(); $funcTag = "a"; $testObject->$funcs[$funcTag]();