|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2019-12-13 20:29 UTC] donatj at gmail dot com
 Description: ------------ Calls to private static methods and members from the same class via static:: work in the same class extended by another class. Calls to private constants from the same class via static:: do not work. Test script: --------------- https://3v4l.org/HiPuc Expected result: ---------------- Expect uniform behaviour in one way or the other. Actual result: -------------- Private methods and members are accessible. Constants are not. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 12:00:01 2025 UTC | 
Including test script in report since link may vanish Test script: ------------ <?php class A { private static function VALUE1(){ return 'func'; } private static $VALUE2 = 'var'; private const VALUE3 = 'cost'; public static function func_value(){ return static::VALUE1(); } public static function member_value(){ return static::$VALUE2; } public static function const_value(){ return static::VALUE3; } } class B extends A { } echo A::func_value(); echo "\n"; echo B::func_value(); echo "\n---\n"; echo A::member_value(); echo "\n"; echo B::member_value(); echo "\n---\n"; echo A::const_value(); echo "\n"; echo B::const_value();