#27926 [Opn->Bgs]: No access-modified constants

From: Date: Mon, 03 Apr 2006 10:39:30 +0000
Subject: #27926 [Opn->Bgs]: No access-modified constants
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95253@lists.php.net to get a copy of this message
ID: 27926 Updated by: tony2001@php.net Reported By: jevon at jevon dot org -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: XP SP1 PHP Version: 5.0.0RC1 New Comment: Duplicate of bug #27022. Previous Comments: ------------------------------------------------------------------------ [2004-04-08 20:43:06] jevon at jevon dot org Description: ------------ It doesn't appear that you can change the access modifiers on constants - are they public by default? It seems to make more sense to be able to define access modifiers on constants (since you can with every other component in classes). Consistency? Reproduce code: --------------- <?php class Foo { const a = 1; public const b = 2; private const c = 3; static function bar() { return c; } } echo Foo::a; echo Foo::b; echo Foo::c; echo Foo::bar(); ?> Expected result: ---------------- 1 2 ERROR: Cannot access a private constant 'c' 3 Actual result: -------------- Parse error: parse error, unexpected T_CONST, expecting T_VARIABLE in C:\Web\construct\php\php5test\test10.php on line 4 PHP Parse error: parse error, unexpected T_CONST, expecting T_VARIABLE in C:\Web\construct\php\php5test\test10.php on line 4 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27926&edit=1

« previous php.bugs (#95253) next »