Bug #71193 [Opn->Nab]: old bug has reappeared

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

 ID:                 71193
 Updated by:         [email protected]
 Reported by:        iam4webwork at hotmail dot com
 Summary:            old bug has reappeared
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            *General Issues
 Operating System:   n/a
 PHP Version:        7.0.1
 Block user comment: N
 Private report:     N

 New Comment:

PHP 7 changed how expressions like those are evaluated.
https://wiki.php.net/rfc/uniform_variable_syntax

Use A::{$y[0]}()


Previous Comments:
------------------------------------------------------------------------
[2015-12-22 05:00:17] iam4webwork at hotmail dot com

Description:
------------
Cannot statically call a method if its name is in an array.  Last time this was an issue was apparently back in 2004 (see bug #27669).  This bug effects PHP versions 7.0.0alpha2 - 7.0.1, 7.1@2015-11 (see https://3v4l.org/8MTtD)

Test script:
---------------
<?php

class A {
   static function hello(){
      echo "Hello World\n";
   }
}

$x = 'hello';
$y[0] = 'hello';

A::$x();
A::$y[0]();

Expected result:
----------------
Hello World
Hello World

Actual result:
--------------
Hello World

Fatal error: Uncaught Error: Access to undeclared static property: A::$y in /in/8MTtD:11
Stack trace:
#0 {main}
  thrown in /in/8MTtD on line 11

Process exited with code 255.


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



--
Edit this bug report at https://bugs.php.net/bug.php?id=71193&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.