AW: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-26 Thread Robert Stoll
Hi Nikita > -Ursprüngliche Nachricht- > Von: Nikita Popov [mailto:nikita@gmail.com] > Gesendet: Montag, 6. Oktober 2014 23:54 > An: PHP internals > Betreff: [PHP-DEV] [RFC] Exceptions in the engine > > Hi internals! > > During the PHP 5.6 development cycl

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-25 Thread Rowan Collins
Dmitry Stogov wrote on 25/02/2015 14:07: No. The proposal is only about fatal engine errors, like "Fatal Error: Call to undefined function %s()". Instead of script termination they will throw exceptions. fopen() won't be touched at all. It's out of scope of proposal. Hi Dmitry, I was respondi

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-25 Thread Dmitry Stogov
On Wed, Feb 25, 2015 at 4:19 PM, Rowan Collins wrote: > Tony Marston wrote on 21/02/2015 10:08: > >> ""Nikita Nefedov"" wrote in message news:op.xuco5eutc9evq2@nikita-pc... >> >>> >>> On Fri, 20 Feb 2015 12:39:33 +0300, Tony Marston < >>> tonymars...@hotmail.com> wrote: >>> I disagree.

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-25 Thread Lester Caine
On 25/02/15 13:19, Rowan Collins wrote: >>> Tony, first of all - this still breaks BC, because exception is being >>> thrown in a place where it used not to be... >> >> I disagree. The following function calls would not throw exceptions >>fopen(...); >>fwrite(...); >>fclose(...); >> >>

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-25 Thread Rowan Collins
Tony Marston wrote on 21/02/2015 10:08: ""Nikita Nefedov"" wrote in message news:op.xuco5eutc9evq2@nikita-pc... On Fri, 20 Feb 2015 12:39:33 +0300, Tony Marston wrote: I disagree. Exceptions were originally invented to solve the semipredicate problem which only exists with procedural func

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-22 Thread Tony Marston
"Pierre Joye" wrote in message news:CAEZPtU7vt=ppk4p3vfzflaepzi_wfr2hr_av+dtzvd6d2dz...@mail.gmail.com... On Feb 21, 2015 2:08 AM, "Tony Marston" wrote: ""Nikita Nefedov"" wrote in message news:op.xuco5eutc9evq2@nikita-pc... On Fri, 20 Feb 2015 12:39:33 +0300, Tony Marston wrote: I

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-21 Thread Pierre Joye
On Feb 21, 2015 2:08 AM, "Tony Marston" wrote: > > ""Nikita Nefedov"" wrote in message news:op.xuco5eutc9evq2@nikita-pc... > >> >> On Fri, 20 Feb 2015 12:39:33 +0300, Tony Marston wrote: >>> >>> >>> I disagree. Exceptions were originally invented to solve the semipredicate problem which only exi

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-21 Thread Tony Marston
""Nikita Nefedov"" wrote in message news:op.xuco5eutc9evq2@nikita-pc... On Fri, 20 Feb 2015 12:39:33 +0300, Tony Marston wrote: I disagree. Exceptions were originally invented to solve the semipredicate problem which only exists with procedural functions, not object methods. Many OO puris

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-20 Thread Nikita Nefedov
On Fri, 20 Feb 2015 12:39:33 +0300, Tony Marston wrote: I disagree. Exceptions were originally invented to solve the semipredicate problem which only exists with procedural functions, not object methods. Many OO purists would like exceptions to be thrown everywhere, but this would presen

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-20 Thread Tony Marston
"Dmitry Stogov" wrote in message news:CA+9eiLu634OpuXVT8NnwZwitqc=s4g8ubbmj+cob4nmqcpx...@mail.gmail.com... On Thu, Feb 19, 2015 at 12:03 PM, Tony Marston wrote: "Rowan Collins" wrote in message news:54e4fac2.7060...@gmail.com... Tony Marston wrote on 18/02/2015 10:52: "Rowan Collins"

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-19 Thread Jonathan Wage
I am not familiar with the implementation details but from my perspective this would be a nice improvement. I have had a difficult time debugging PHP fatal errors over the years and I think this kind of change would help improve that. On Mon, Oct 6, 2014 at 4:53 PM, Nikita Popov wrote: > Hi inte

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-19 Thread Alexey Zakhlestin
> On 19 Feb 2015, at 12:54, Dmitry Stogov wrote: > > I think we may introduce the following hierarchy > > abstarct class BaseException { > } > class Exception extends BaseException { > } > class EngineException extends BaseException { > } > > the existing code that caught Exception is going to

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-19 Thread Dmitry Stogov
On Thu, Feb 19, 2015 at 12:03 PM, Tony Marston wrote: > "Rowan Collins" wrote in message news:54e4fac2.7060...@gmail.com... > > >> Tony Marston wrote on 18/02/2015 10:52: >> >>> "Rowan Collins" wrote in message news:54e32caa.5030...@gmail.com... >>> Tony Marston wrote on 17/02/2015 09

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-19 Thread Tony Marston
"Nikita Nefedov" wrote in message news:CALuY8tjUq70eLkV-MbDi-fEXZvWTFi82zCNmWr7tmvpiES9=p...@mail.gmail.com... On 18 Feb 2015 13:53, "Tony Marston" wrote: Could it be restricted to the current scope? In your example the call to fopen() exists in the load_data() function and is not in a try

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-19 Thread Tony Marston
"Rowan Collins" wrote in message news:54e4fac2.7060...@gmail.com... Tony Marston wrote on 18/02/2015 10:52: "Rowan Collins" wrote in message news:54e32caa.5030...@gmail.com... Tony Marston wrote on 17/02/2015 09:59: "Rowan Collins" wrote in message news:54e1c993.1070...@gmail.com... Ton

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-18 Thread Rowan Collins
Tony Marston wrote on 18/02/2015 10:52: "Rowan Collins" wrote in message news:54e32caa.5030...@gmail.com... Tony Marston wrote on 17/02/2015 09:59: "Rowan Collins" wrote in message news:54e1c993.1070...@gmail.com... Tony Marston wrote on 16/02/2015 10:09: This RFC only mentions errors with

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-18 Thread Nikita Nefedov
On 18 Feb 2015 13:53, "Tony Marston" wrote: > > Could it be restricted to the current scope? In your example the call to fopen() exists in the load_data() function and is not in a try ... catch block within *that* function, so the fact that the call to load_data() is within a try ... catch block s

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-18 Thread Tony Marston
"Rowan Collins" wrote in message news:54e32caa.5030...@gmail.com... Tony Marston wrote on 17/02/2015 09:59: "Rowan Collins" wrote in message news:54e1c993.1070...@gmail.com... Tony Marston wrote on 16/02/2015 10:09: This RFC only mentions errors with object methods, so what impact would it

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-17 Thread Rowan Collins
Tony Marston wrote on 17/02/2015 09:59: "Rowan Collins" wrote in message news:54e1c993.1070...@gmail.com... Tony Marston wrote on 16/02/2015 10:09: This RFC only mentions errors with object methods, so what impact would it have with procedural functions. For example, if fopen('nonexistantfil

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-17 Thread Bob Weinand
> Am 17.02.2015 um 11:21 schrieb Benjamin Eberlei : > On Tue, Feb 17, 2015 at 11:14 AM, Bob Weinand > wrote: > > Am 14.02.2015 um 00:25 schrieb Nikita Popov > >: > > > > On Mon, Oct 6, 2014 at 11:53 PM, Nikita Popov >

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-17 Thread Benjamin Eberlei
On Tue, Feb 17, 2015 at 11:14 AM, Bob Weinand wrote: > > Am 14.02.2015 um 00:25 schrieb Nikita Popov : > > > > On Mon, Oct 6, 2014 at 11:53 PM, Nikita Popov > wrote: > > > >> Hi internals! > >> > >> During the PHP 5.6 development cycle I have proposed an RFC [1] that > >> suggested the use of ex

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-17 Thread Bob Weinand
> Am 14.02.2015 um 00:25 schrieb Nikita Popov : > > On Mon, Oct 6, 2014 at 11:53 PM, Nikita Popov wrote: > >> Hi internals! >> >> During the PHP 5.6 development cycle I have proposed an RFC [1] that >> suggested the use of exceptions instead of fatal errors in the engine. At >> the time the pro

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-17 Thread Tony Marston
"Rowan Collins" wrote in message news:54e1c993.1070...@gmail.com... Tony Marston wrote on 16/02/2015 10:09: This RFC only mentions errors with object methods, so what impact would it have with procedural functions. For example, if fopen('nonexistantfile.txt') fails the return value is FALSE a

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-16 Thread Rowan Collins
Tony Marston wrote on 16/02/2015 10:09: This RFC only mentions errors with object methods, so what impact would it have with procedural functions. For example, if fopen('nonexistantfile.txt') fails the return value is FALSE and an E_WARNING is generated, but it is difficult to trap the error me

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-16 Thread Tony Marston
"Rowan Collins" wrote in message news:54e12349.7070...@gmail.com... On 14/02/2015 00:09, Yasuo Ohgaki wrote: Hi Nikita, On Tue, Oct 7, 2014 at 6:53 AM, Nikita Popov wrote: As such I'm re-proposing this RFC for inclusion in PHP 7: https://wiki.php.net/rfc/engine_exceptions_for_php7

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-15 Thread Rowan Collins
On 14/02/2015 00:09, Yasuo Ohgaki wrote: Hi Nikita, On Tue, Oct 7, 2014 at 6:53 AM, Nikita Popov wrote: As such I'm re-proposing this RFC for inclusion in PHP 7: https://wiki.php.net/rfc/engine_exceptions_for_php7 The RFC text is essentially the same as previously, with the primary dif

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-13 Thread Nikita Popov
On Sat, Feb 14, 2015 at 1:09 AM, Yasuo Ohgaki wrote: > Hi Nikita, > > On Tue, Oct 7, 2014 at 6:53 AM, Nikita Popov wrote: > >> As such I'm re-proposing this RFC for inclusion in PHP 7: >> >> https://wiki.php.net/rfc/engine_exceptions_for_php7 >> >> The RFC text is essentially the same as pre

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-13 Thread Yasuo Ohgaki
Hi Nikita, On Tue, Oct 7, 2014 at 6:53 AM, Nikita Popov wrote: > As such I'm re-proposing this RFC for inclusion in PHP 7: > > https://wiki.php.net/rfc/engine_exceptions_for_php7 > > The RFC text is essentially the same as previously, with the primary > difference being that parse errors are

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-10 Thread Andrea Faulds
On 10 Oct 2014, at 13:31, Patrick Schaaf wrote: > I would love to be able to catch, at toplevel. with an error handler or > otherwise, both the memory limits exceeded and time limit exceeded cases. > > These two safeguards, by themselves, are not instabilities, right? The > limits could be set

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-10 Thread Dan Ackroyd
Patrick wrote: > I would love to be able to catch, at toplevel. with an error handler or > otherwise, both the memory limits exceeded and time limit exceeded cases. +1, as the kids today say. I don't think that it should require any new code - we already have the ability to extend the memory limi

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-10 Thread Patrick Schaaf
Looking at the list of fatal errors Nikita classified as not suitable for converting to exceptions, I'd like to take exception : ) with two of them: I would love to be able to catch, at toplevel. with an error handler or otherwise, both the memory limits exceeded and time limit exceeded cases. Th

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-10 Thread Nikita Popov
On Tue, Oct 7, 2014 at 1:07 AM, Stas Malyshev wrote: > Hi! > > > As such I'm re-proposing this RFC for inclusion in PHP 7: > > > > https://wiki.php.net/rfc/engine_exceptions_for_php7 > > > > The RFC text is essentially the same as previously, with the primary > > difference being that parse e

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-07 Thread Rowan Collins
On 07/10/2014 21:07, Levi Morrison wrote: I would also argue that you should never, in any language, catch a NPE. The only time you should catch an NPE is if you are catching all exceptions, such as in a FastCGI daemon that will cleanly shutdown afterwards. If you're not allowed to catch it, why

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-07 Thread Levi Morrison
>> I would also argue that >>you should never, in any language, catch a NPE. The only time you >>should catch an NPE is if you are catching all exceptions, such as in >>a FastCGI daemon that will cleanly shutdown afterwards. > > If you're not allowed to catch it, why make it an exception? Benefits

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-07 Thread Rowan Collins
On 7 October 2014 18:52:35 GMT+01:00, Levi Morrison wrote: >On Tue, Oct 7, 2014 at 7:58 AM, Rowan Collins >wrote: >> As an example where a specific exception would be useful, but a >generic one >> would not, consider a fluent interface which sometimes bugs out and >returns >> NULL. If wrapped in

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-07 Thread Stas Malyshev
Hi! > 1) I'm not sure if "cacth(Exception $e)" should catch engine and parser > exceptions. May be it's better to introduce interface or common parent > class "Catchable" and then make Exception, EngineException and > ParseException implement it. In case user would like to catch all the error > at

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-07 Thread Stas Malyshev
Hi! > yes, this was also suggested before, but that will be also a BC break > for those people already using the name of the new parent class > (https://github.com/search?l=php&q=EngineException&type=Code&utf8=%E2%9C%93 > for example). This btw looks like a bigger issue (though many of them are n

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-07 Thread Levi Morrison
On Tue, Oct 7, 2014 at 7:58 AM, Rowan Collins wrote: > Lars Strojny wrote (on 06/10/2014): > >> Hi Nikita, >> >> On 06 Oct 2014, at 23:53, Nikita Popov wrote: >> [...] >>> >>> As such I'm re-proposing this RFC for inclusion in PHP 7: >>> >>> https://wiki.php.net/rfc/engine_exceptions_for_php7

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-07 Thread Markus Fischer
On 07.10.2014 14:15, Ferenc Kovacs wrote: > yes, this was also suggested before, but that will be also a BC break for > those people already using the name of the new parent class ( > https://github.com/search?l=php&q=EngineException&type=Code&utf8=%E2%9C%93 > for example). > which can be still an

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-07 Thread Rowan Collins
Lars Strojny wrote (on 06/10/2014): Hi Nikita, On 06 Oct 2014, at 23:53, Nikita Popov wrote: [...] As such I'm re-proposing this RFC for inclusion in PHP 7: https://wiki.php.net/rfc/engine_exceptions_for_php7 The RFC text is essentially the same as previously, with the primary difference

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-07 Thread Ralf Lang
On 06.10.2014 23:53, Nikita Popov wrote: > Hi internals! > > During the PHP 5.6 development cycle I have proposed an RFC [1] that > suggested the use of exceptions instead of fatal errors in the engine. At > the time the proposal was declined, because the change was judged too > intrusive for a mi

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-07 Thread Ferenc Kovacs
On Tue, Oct 7, 2014 at 11:51 AM, Christian Stoller wrote: > From: Dan Ackroyd [mailto:dan...@basereality.com] ,Sent: Tuesday, October > 07, 2014 10:55 AM > > > > Stas wrote: > > > >> The only issue I think we need to discuss is catch(Exception $e). Now it > >> would catch much more than before, i

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-07 Thread Dmitry Stogov
Hi Nikita, I very like the idea. Actually, it's a long time desired php feature that many big php users miss. They don't like to show 500 response in any case. Also +1 for removing ability of silent E_RECOVERABLE_ERROR bypass :) I think that few things may be "improved" 1) I'm not sure if "cact

RE: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-07 Thread Christian Stoller
From: Dan Ackroyd [mailto:dan...@basereality.com] ,Sent: Tuesday, October 07, 2014 10:55 AM > > Stas wrote: > >> The only issue I think we need to discuss is catch(Exception $e). Now it >> would catch much more than before, if we do no changes. > > It's not clear why would that be an issue - can

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-07 Thread Ferenc Kovacs
On Tue, Oct 7, 2014 at 10:55 AM, Dan Ackroyd wrote: > Stas wrote: > > > The only issue I think we need to discuss is catch(Exception $e). Now it > > would catch much more than before, if we do no changes. > > It's not clear why would that be an issue - can you specify what the > problem would be?

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-07 Thread Dan Ackroyd
Stas wrote: > The only issue I think we need to discuss is catch(Exception $e). Now it > would catch much more than before, if we do no changes. It's not clear why would that be an issue - can you specify what the problem would be? Also, if we changed `catch(Exception $e)` to not catch all excep

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-06 Thread Stas Malyshev
Hi! > As such I'm re-proposing this RFC for inclusion in PHP 7: > > https://wiki.php.net/rfc/engine_exceptions_for_php7 > > The RFC text is essentially the same as previously, with the primary > difference being that parse errors are now converted to exceptions as well. > This was previously

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-06 Thread Lars Strojny
Hi Nikita, On 06 Oct 2014, at 23:53, Nikita Popov wrote: [...] > As such I'm re-proposing this RFC for inclusion in PHP 7: > >https://wiki.php.net/rfc/engine_exceptions_for_php7 > > The RFC text is essentially the same as previously, with the primary > difference being that parse errors are

[PHP-DEV] [RFC] Exceptions in the engine

2014-10-06 Thread Nikita Popov
Hi internals! During the PHP 5.6 development cycle I have proposed an RFC [1] that suggested the use of exceptions instead of fatal errors in the engine. At the time the proposal was declined, because the change was judged too intrusive for a minor version. As such I'm re-proposing this RFC for i

Re: [PHP-DEV] [RFC] Exceptions in the engine

2013-10-28 Thread Rowan Collins
On 27/10/2013 15:51, Nikita Popov wrote: Unless we have *concrete* plans regarding PHP 6 saying "this should go into (a hypothetical, non-existing) PHP 6" is roughly equivalent to just declining the feature. I agree with that, and think it is a real problem, but there are two solutions: aban

Re: [PHP-DEV] [RFC] Exceptions in the engine

2013-10-27 Thread Rowan Collins
On 27/10/2013 15:51, Nikita Popov wrote: The question is always "how big is the break?" not "is there a break?". The latter question doesn't even make sense because any change to PHP - including the most trivial bugfixes - breaks compatibility to *some* degree (well, unless the change is "fix

Re: [PHP-DEV] [RFC] Exceptions in the engine

2013-10-27 Thread Pierre Joye
On Sun, Oct 27, 2013 at 5:11 PM, Rowan Collins wrote: > On 27/10/2013 15:51, Nikita Popov wrote: > >> Unless we have *concrete* plans regarding PHP 6 saying "this should go >> into (a hypothetical, non-existing) PHP 6" is roughly equivalent to just >> declining the feature. Not sure where Nikita

Re: [PHP-DEV] [RFC] Exceptions in the engine

2013-10-26 Thread Jordi Boggiano
On Fri, Oct 25, 2013 at 3:55 PM, Richard Bradley wrote: >> How could anything be reliant on the behaviour of a fatal error in any >> meaningful way ?? >> >> Cheers >> Joe > > In plenty of ways: for example currently frameworks can "catch" fatal errors > using "register_shutdown_function" and dis

Re: [PHP-DEV] [RFC] Exceptions in the engine

2013-10-25 Thread Andrea Faulds
On 24/10/2013 18:41, Nikita Popov wrote: Hi internals! I'd like to propose an RFC, which allows the use of exceptions within the engine and also allows changing existing fatal errors to exceptions: https://wiki.php.net/rfc/engine_exceptions This topic has been cropping up in the discussio

Re: [PHP-DEV] [RFC] Exceptions in the engine

2013-10-24 Thread Stas Malyshev
Hi! Looking at the patch, it converts zend_error_noreturn into ZEND_IMPOSSIBLE, which is nothing in non-debug mode. This means code that expected that execution ceases it this point (and jumps to a safe bail-out point) now just continues in non-debug mode (probably causing crash or memory corrupti

Re: [PHP-DEV] [RFC] Exceptions in the engine

2013-10-24 Thread Johannes Schlüter
On Thu, 2013-10-24 at 19:41 +0200, Nikita Popov wrote: > Hi internals! > > I'd like to propose an RFC, which allows the use of exceptions within the > engine and also allows changing existing fatal errors to exceptions: If there is a way to recover from a fatal error it shouldn't be E_ERROR but E

[PHP-DEV] [RFC] Exceptions in the engine

2013-10-24 Thread Nikita Popov
Hi internals! I'd like to propose an RFC, which allows the use of exceptions within the engine and also allows changing existing fatal errors to exceptions: https://wiki.php.net/rfc/engine_exceptions This topic has been cropping up in the discussions for several of the recent RFCs and I thin