Bug #70908 [Opn]: function name must be string

[email protected]
Newsgroups php.standards
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=70908&edit=1

 ID:                 70908
 Updated by:         [email protected]
 Reported by:        hebxiaojb at 163 dot com
 Summary:            function name must be string
 Status:             Open
 Type:               Bug
 Package:            PHP Language Specification
 Operating System:   CentOS
 PHP Version:        7.0.0RC7
 Block user comment: N
 Private report:     N

 New Comment:

use $x->{$arr[1]}();


Previous Comments:
------------------------------------------------------------------------
[2015-11-13 09:33:30] hebxiaojb at 163 dot com

Description:
------------
PHP Notice:  Array to string conversion in /data/x.php on line 11
PHP Notice:  Undefined property: x::$Array in /data/x.php on line 11
PHP Fatal error:  Uncaught Error: Function name must be a string in /data/x.php:11
Stack trace:
#0 {main}
  thrown in /data/x.php on line 11

Test script:
---------------
<?php
class x {
    function x() {
    }
    function common() {
    }
}

$x = new x();
$arr = ['x', 'common'];
$x->$arr[1]();

Actual result:
--------------
PHP Notice:  Array to string conversion in /data/x.php on line 11
PHP Notice:  Undefined property: x::$Array in /data/x.php on line 11
PHP Fatal error:  Uncaught Error: Function name must be a string in /data/x.php:11
Stack trace:
#0 {main}
  thrown in /data/x.php on line 11


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=70908&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.