Re: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition

2016-06-20 Thread Rowan Collins
On 20 June 2016 21:42:43 GMT+01:00, Dmitry Stogov  wrote:
>The RFC was updated to propose this change only for PHP 8.0, and
>thereby, vote is delayed for uncertain time.

Why can't we have a vote now, committing to a change in 8.0?

Doing so would have two advantages:
- Users have extra advantage warning of the change. Even if the message doesn't 
change, the documentation could include a warning, and people could spread the 
word
- Long-term engine developments could proceed in the safe assumption that the 
change will be accepted, rather than having to consider the possibility of a 
future vote forcing a backtrack.

As I've said elsewhere, the only reason we don't have any plans for 8.0 is 
because we're not making any plans for 8.0; we can start doing that whenever we 
like, and using whatever process we like. Targeting a few votes and listing 
them somewhere seems as good a place to start as any.

Regards,

-- 
Rowan Collins
[IMSoP]

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition

2016-06-20 Thread Dmitry Stogov
The RFC was updated to propose this change only for PHP 8.0, and thereby, vote 
is delayed for uncertain time.

I think, changing "Notice: Constant %s already defined" into "Deprecated: ..." 
in 7.1 doesn't make a lot of sense.


Thanks. Dmitry.


From: Pierre Joye <pierre@gmail.com>
Sent: Friday, June 17, 2016 9:31:33 AM
To: Dmitry Stogov
Cc: PHP internals; Stas Malyshev
Subject: Re: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition


On Jun 17, 2016 1:10 PM, "Dmitry Stogov" 
<dmi...@zend.com<mailto:dmi...@zend.com>> wrote:
>
> Got it :(
> Then this may be a serious BC break, and it's better to depricate it in 7.1 
> and throw exception only in 8.

Fully agree. Thanks :)

> Thanks. Dmitry.
>
>
>
> On Thu, Jun 16, 2016 at 8:14 PM +0300, "Stanislav Malyshev" 
> <smalys...@gmail.com<mailto:smalys...@gmail.com><mailto:smalys...@gmail.com<mailto:smalys...@gmail.com>>>
>  wrote:
>
> 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
> smalys...@gmail.com<mailto:smalys...@gmail.com>


Re: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition

2016-06-17 Thread Pierre Joye
On Jun 17, 2016 1:10 PM, "Dmitry Stogov"  wrote:
>
> Got it :(
> Then this may be a serious BC break, and it's better to depricate it in
7.1 and throw exception only in 8.

Fully agree. Thanks :)

> Thanks. Dmitry.
>
>
>
> On Thu, Jun 16, 2016 at 8:14 PM +0300, "Stanislav Malyshev" <
smalys...@gmail.com> wrote:
>
> 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
> smalys...@gmail.com


Re: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition

2016-06-17 Thread Dmitry Stogov
Got it :(
Then this may be a serious BC break, and it's better to depricate it in 7.1 and 
throw exception only in 8.

Thanks. Dmitry.



On Thu, Jun 16, 2016 at 8:14 PM +0300, "Stanislav Malyshev" 
> wrote:

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
smalys...@gmail.com


Re: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition

2016-06-16 Thread Stanislav Malyshev
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
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition

2016-06-16 Thread Lester Caine
On 16/06/16 07:44, Dmitry Stogov wrote:
> 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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition

2016-06-16 Thread Pierre Joye
On Jun 11, 2016 4:27 AM, "Dmitry Stogov"  wrote:
>
> In general, you are right, but this is possible only if application
ignores Error exceptions...

Exactly.

Many if not hundred of applications do not even use exception but if a
couple of places, let alone plug-ins for these apps.

Most of these apps is what I called main stream applications. They are
provided as SaaS or ready to be installed. The providers taking care of the
system parts, php included.

Now what will happen if they update and exception start to be throw for
that?

Right, they will downgrade or not update at all for the good ones (tested).

To me it sounds like a pretty bad plan to ease the migration path.

In other words, it looks to me that you are working on something bigger,
early phase. This things seems to require more and more clean paths and
rules.

This is alone is something to justify to start to plan 8. And we all know
Jit will be for 8. Let start even if the Jit itself is not even officially
started.


Re: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition

2016-06-16 Thread Dmitry Stogov
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.


From: Dmitry Stogov
Sent: Friday, June 10, 2016 11:06:55 PM
To: PHP internals
Subject: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition


Hi internals,


Please review: https://wiki.php.net/rfc/constant_redefinition


Thanks. Dmitry.


Re: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition

2016-06-11 Thread Fleshgrinder
On 6/10/2016 10:06 PM, Dmitry Stogov wrote:
> 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



signature.asc
Description: OpenPGP digital signature


Re: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition

2016-06-11 Thread Xinchen Hui
Hey:

On Sat, Jun 11, 2016 at 4:06 AM, Dmitry Stogov  wrote:

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


Re: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition

2016-06-10 Thread Dmitry Stogov
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:



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?


Re: [PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition

2016-06-10 Thread Levi Morrison
On Fri, Jun 10, 2016 at 2:06 PM, Dmitry Stogov  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:



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?

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] [RFC] Throw Exception on Attempt of Constant Redefinition

2016-06-10 Thread Dmitry Stogov
Hi internals,


Please review: https://wiki.php.net/rfc/constant_redefinition


Thanks. Dmitry.