Bug #77295 [NEW]: Class 'static' not found (parent and self too)

From: Date: Thu, 13 Dec 2018 18:40:49 +0000
Subject: Bug #77295 [NEW]: Class 'static' not found (parent and self too)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218436@lists.php.net to get a copy of this message
From:             dams
Operating system: Irrelevant
PHP version:      7.3.0
Package:          Class/Object related
Bug Type:         Bug
Bug description:Class 'static' not found (parent and self too)

Description:
------------
When calling dynamically a static method, with array('static',
'method'), from the right class context, PHP emits an error 'Class
'static' not found'.

Using call_user_func($method); with the same array, leads to the correct
call to the method. 

The same problem applies to 'self' and 'parent'.

https://3v4l.org/VKFaQ
https://3v4l.org/0eacu
https://3v4l.org/HkFmd

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

class x {   
  static function a() {
  	  // display the current class
     echo __METHOD__;
  } 

  static function b($method) {
  	  // display the current class with method a above
  	  call_user_func($method);
          // This stops with a Fatal Error
  	  $method();
  } 
}

(new x)->b(array('static', 'a'));
?>

Expected result:
----------------
x::a
x::a

Actual result:
--------------
x::a
Fatal error: Uncaught Error: Class 'static' not found

-- 
Edit bug report at https://bugs.php.net/bug.php?id=77295&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=77295&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=77295&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=77295&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=77295&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=77295&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=77295&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=77295&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=77295&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=77295&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=77295&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=77295&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=77295&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=77295&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77295&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=77295&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=77295&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=77295&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77295&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=77295&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=77295&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#218436) next »