In general, you are right, but this is possible only if application ignores 
Error exceptions...


________________________________
From: morrison.l...@gmail.com <morrison.l...@gmail.com> on behalf of Levi 
Morrison <le...@php.net>
Sent: Friday, June 10, 2016 11:50:26 PM
To: Dmitry Stogov
Cc: PHP internals
Subject: Re: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition

On Fri, Jun 10, 2016 at 2:06 PM, Dmitry Stogov <dmi...@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?

Reply via email to