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?
Hey:
Hi internals,
Please review: https://wiki.php.net/rfc/constant_redefinition
we could also change the
#define DEFAULT_OPTIMIZATION_LEVEL "0x7FFFBFFF" (introduced in
https://github.com/php/php-src/commit/40702799b5f08b093477098881b6e0cfcb3ea411
)
to -1
I think it's better also include this into the patch?
thanks
Thanks. Dmitry.
--
Xinchen Hui
@Laruence
http://www.laruence.com/
Hi internals,
Please review: https://wiki.php.net/rfc/constant_redefinition
Thanks. Dmitry.
This would be a breaking change in a minor release again.
-1
However +1 for PHP 8.
--
Richard "Fleshgrinder" Fussenegger
Please review: https://wiki.php.net/rfc/constant_redefinition
This would be a breaking change in a minor release again.
-1
However +1 for PHP 8.
I'm also somewhat concerned with regard to turning a notice into an
exception in a minor version. I would prefer to have an alternative
voting option to deprecate constant redefinition in 7.1 and to finally
disallow it in 8.0.
It might be helpful to make a rough plan when PHP 8.0 will be released.
If that will be far in the future (say 5 years or even more), such a
change might be okay for a minor version (presumably nobody wants to
wait such a long time for this and similar improvements), but if PHP 8.0
will be released much earlier, it might be tolerable to wait and to not
break semantic versioning.
--
Christoph M. Becker
The voting dates was changed to Jun 24 (to satisfy 2 weeks discussion period).
In my opinion the BC break is minimal.
Actually, the "wrong" behavior was reported by https://bugs.php.net/bug.php?id=71127
Before this, opcache worked "improperly" for few years (at least since php-5.4).
Unfortunately, we fixed https://bugs.php.net/bug.php?id=71127 too later and weren't able to fix PHP-7.0 "properly".
Now I propose a safer and more consistent way of handling attempts of constants redefinition.
RFC also proposes a way to "fix" affected applications, wrapping constant definitions, that may be redefined, with try/catch.
Thanks. Dmitry.
RFC also proposes a way to "fix" affected applications, wrapping constant definitions, that may be redefined, with try/catch.
Doesn't anybody remember the problems which STILL have to be resolved
with changes in PHP5.2/3/4 which require the assistance of programmers
to fix naive users problems. Now many of the new features being added
will not be currently used in legacy code, but can anybody ensure that
all of the BC changes being currently pushed for will not cause a more
general PHP5.4 style block to upgrading?
HAVING to add changes to code to retain a legacy style of operation is
something that should only happen in a major version. Isn't this why
most big projects no longer bother with many small version changes? What
is Firefox up to now ...
However going down that root does require LTS builds which is something
else which is maintaining PHP5.3 in the field. I am now getting used to
the changes in PHP7, but the current roadmap for PHP7.1 is just another
PHP5.4 in my book and it does create a case for my simply rolling back
to PHP5 since none of my production systems have been fully updated so
they can use PHP7 yet ...
--
Lester Caine - G8HFL
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
Hi!
Please review: https://wiki.php.net/rfc/constant_redefinition
I would propose to not throw an error if constant is redefined to
exactly the same value. Some of the code might be doing this
unknowingly, e.g. by writing include instead of include_once, and
there's no real reason to break it.
--
Stas Malyshev
smalyshev@gmail.com