From:             jevon at jevon dot org
Operating system: XP SP1
PHP version:      5.0.0RC1
PHP Bug Type:     Zend Engine 2 problem
Bug description:  No access-modified constants

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 bug report at http://bugs.php.net/?id=27926&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27926&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27926&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27926&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27926&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27926&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27926&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27926&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27926&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27926&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27926&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27926&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27926&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27926&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27926&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27926&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27926&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27926&r=float

Reply via email to