class constants bugs

php.internals

Cristiano Duarte

22 years ago
1) This code: <? class Priority { const DEBUG = 0; const INFO = 1; const WARN = 2; const ERROR = 3; const FATAL = 4; const MAX_PRIORITY = FATAL; } class ExtendedPriority extends Priority { const REMOTE = Priority::MAX_PRIORITY + 1; const URGENT = parent::MAX_PRIORITY + 2; } ?> results in this error: PHP Fatal error: Unsupported operand types in /test.php on line 13 Shouldn't class constants support simple expressions ? 2) Also, this code: <? class test { const TEST = "hi"; const TEST1 = self::TEST . "ih"; } ?> Results in segmentation fault. Cristiano Duarte

Derick Rethans

22 years ago
On Mon, 29 Sep 2003, Cristiano Duarte wrote:
> Shouldn't class constants support simple expressions ?
No. Derick
-- "Interpreting what the GPL actually means is a job best left to those that read the future by examining animal entrails." ------------------------------------------------------------------------- Derick Rethans http://derickrethans.nl/ International PHP Magazine http://php-mag.net/ -------------------------------------------------------------------------

Cristiano Duarte

22 years ago
"Derick Rethans" <derick@php.net> escreveu na mensagem news:Pine.LNX.4.53.0309300959170.19526@jdi.jdimedia.nl...
> On Mon, 29 Sep 2003, Cristiano Duarte wrote: > > > Shouldn't class constants support simple expressions ? > > No.
So It's a compiler bug if it not complaining abount contant expressions... P.S.: I remember that on this list someone posted a patch to allow these kind of expressions. I think at that time it was commited to CVS. Are you shure that these expressions won't be allowed ? Cristiano