Bug #70908 [Opn]: function name must be string
| From: | laruence@php.net | Date: | Fri, 13 Nov 2015 10:46:15 +0000 |
| Subject: | Bug #70908 [Opn]: function name must be string | ||
| References: | 1 | Groups: | php.standards |
| Request: | Send a blank email to standards-+get-875@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70908&edit=1
ID: 70908
Updated by: laruence@php.net
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