Re: [RFC] Throw Exception on Attempt of Constant Redefinition
| From: | Levi Morrison | Date: | Fri, 10 Jun 2016 20:50:26 +0000 |
| Subject: | Re: [RFC] Throw Exception on Attempt of Constant Redefinition | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93887@lists.php.net to get a copy of this message | ||
On Fri, Jun 10, 2016 at 2:06 PM, Dmitry Stogov <dmitry@zend.com> wrote:
> Hi internals,
>
>
> Please review: https://wiki.php.net/rfc/constant_redefinition
>
>
> Thanks. Dmitry.
Dmitry, I am not sure this change will actually allow constant
propagation either. Consider this code:
<?php
const Foo = 1;
class FooFactory {
static function make() {
return Foo;
}
}
?>
In this series of events:
- Foo is declared to be 0
- This above file is now included inside a try-catch block that
catches the error
- FooFactory::make() is now called
If Foo = 1 was propagated then FooFactory::make() will return 1 instead of 0.
Am I missing something?