Bug #78960 [Opn]: Const Privacy on static:: doesn't match func privacy on static::

From: Date: Fri, 07 Feb 2020 22:39:48 +0000
Subject: Bug #78960 [Opn]: Const Privacy on static:: doesn't match func privacy on static::
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225440@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78960&edit=1 ID: 78960 Updated by: googleguy@php.net Reported by: donatj at gmail dot com Summary: Const Privacy on static:: doesn't match func privacy on static:: Status: Open Type: Bug Package: Scripting Engine problem Operating System: All PHP Version: 7.4.0 Block user comment: N Private report: N New Comment: 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(); Previous Comments: ------------------------------------------------------------------------ [2019-12-13 20:29:33] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78960&edit=1

« previous php.bugs (#225440) next »