# class constants bugs

- Thread: https://externals.io/message/4608
- Original archive: https://news-web.php.net/php.internals/4608
- Started by Cristiano Duarte on 2003-09-29T22:47:59+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #4608 — Cristiano Duarte — 2003-09-29T22:47:59+00:00

URL: https://externals.io/message/4608#4608

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

---

## #4609 — Derick Rethans — 2003-09-30T08:00:31+00:00

URL: https://externals.io/message/4608#4609 · In reply to: #4608

> 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/

---

## #4626 — Cristiano Duarte — 2003-09-30T22:51:30+00:00

URL: https://externals.io/message/4608#4626 · In reply to: #4609

"Derick Rethans" <derick@php.net> escreveu na mensagem
news:Pine.LNX.4.53.0309300959170.19526@jdi.jdimedia.nl...
> 
>
> > […]
>
> 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
