Bug #70220 [NEW]: Array to string conversion on dynamic method call

From: Date: Sun, 09 Aug 2015 14:00:35 +0000
Subject: Bug #70220 [NEW]: Array to string conversion on dynamic method call
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195049@lists.php.net to get a copy of this message
From: sebrogier at gmail dot com Operating system: PHP version: 7.0.0beta3 Package: Reproducible crash Bug Type: Bug Bug description:Array to string conversion on dynamic method call Description: ------------ I have an "Array to string conversion" error on the following code. This occurs only when the method is taken directly in the array. When I use a intermediate variable, there are no error. Test script: --------------- <?php class Foo { public function bar() { echo 'a'; } } $foo = new Foo(); foreach ([['bar']] as $test) { $method = $test[0]; $foo->$method(); // displays "a" ==> success } foreach ([['bar']] as $test) { $foo->$test[0](); // Notice "Array to string conversion" followed by // "Function name must be a string" } -- Edit bug report at https://bugs.php.net/bug.php?id=70220&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70220&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70220&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70220&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70220&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70220&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70220&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70220&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70220&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70220&r=support Expected behavior: https://bugs.php.net/fix.php?id=70220&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70220&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70220&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70220&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70220&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70220&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70220&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70220&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70220&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70220&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70220&r=mysqlcfg

« previous php.bugs (#195049) next »