# [VOTE] Exceptions in the engine

- Thread: https://externals.io/message/83596
- Original archive: https://news-web.php.net/php.internals/83596
- Started by Nikita Popov on 2015-02-23T18:15:36+00:00
- Messages: 75
- RFC: Exceptions in the engine (Implemented (PHP 7.0)) — https://externals.io/rfc/engine_exceptions_for_php7.md
- Page 1 of 3: messages 1 to 25 (25 per page, add `?page=N` to the URL)
- Next page: https://externals.io/message/83596.md?page=2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #83596 — Nikita Popov — 2015-02-23T18:15:36+00:00

URL: https://externals.io/message/83596#83596

Hi internals!

Voting on the engine exceptions RFC, which proposes to convert existing
fatal and recoverable fatal errors into exceptions, has opened:

    https://wiki.php.net/rfc/engine_exceptions_for_php7#vote

The primary vote requires a 2/3 majority, as this is a language change.

A second vote will decide whether to use a BaseException based inheritance
hierarchy. This vote uses a simple majority.

Voting is open until 2015-03-08.

Nikita

---

## #83621 — Yasuo Ohgaki — 2015-02-23T23:03:51+00:00

URL: https://externals.io/message/83596#83621 · In reply to: #83596

Hi Nikita,



> Voting on the engine exceptions RFC, which proposes to convert existing
> fatal and recoverable fatal errors into exceptions, has opened:
>
>     https://wiki.php.net/rfc/engine_exceptions_for_php7#vote
>
> The primary vote requires a 2/3 majority, as this is a language change.
>
> A second vote will decide whether to use a BaseException based inheritance
> hierarchy. This vote uses a simple majority.
>

Although, AbstractException sounds better to me. I voted "yes" for it now.

We probably need more specific coding standard for class/interface names
for internal
classes/interfaces.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #83636 — pajousek@gmail.com — 2015-02-24T07:28:22+00:00

URL: https://externals.io/message/83596#83636 · In reply to: #83621

> Hi Nikita,
>
> 
>
> > […]
>
> Although, AbstractException sounds better to me. I voted "yes" for it now.
>
> We probably need more specific coding standard for class/interface names
> for internal
> classes/interfaces.
>
> Regards,
>
> --
> Yasuo Ohgaki
> yohgaki@ohgaki.net

Hello,

I personally find both BaseException and AbstractException ugly. The
"Throwable" is IMHO much better.

Regards
Pavel Kouril

---

## #83645 — Yasuo Ohgaki — 2015-02-24T09:30:37+00:00

URL: https://externals.io/message/83596#83645 · In reply to: #83636

Hi all,



> I personally find both BaseException and AbstractException ugly. The
> "Throwable" is IMHO much better.
>

We definitely need coding(naming) standard :)
We may have coding standard before PHP7 release and cleanup all.

For people dislike BaseException, please do not vote "no" only for this.
It may be changed later.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #83652 — Dennis Birkholz — 2015-02-24T11:04:57+00:00

URL: https://externals.io/message/83596#83652 · In reply to: #83596

Hi,

Am 23.02.2015 um 19:15 schrieb Nikita Popov:
> A second vote will decide whether to use a BaseException based inheritance
> hierarchy. This vote uses a simple majority.

I like this RFC and hope it passes. I am a little concerned about
littering the global namespace. It would be preferable to have a single
namespace that is reserved for all build in classes (like \PHP) that
contains all classes like exceptions. The name BaseException seems to be
a very common one:
https://github.com/search?l=php&q=baseexception&type=Code finds about
14k matches, so this may be a huge BC break if the actual class name is
not changed.

Thanks
Dennis

---

## #83658 — Yasuo Ohgaki — 2015-02-24T12:29:08+00:00

URL: https://externals.io/message/83596#83658 · In reply to: #83652

Hi all,

On Tue, Feb 24, 2015 at 8:04 PM, Dennis Birkholz <dennis@birkholz.biz>
wrote:

> Am 23.02.2015 um 19:15 schrieb Nikita Popov:
> > […]
> inheritance
> > […]
>
> I like this RFC and hope it passes. I am a little concerned about
> littering the global namespace. It would be preferable to have a single
> namespace that is reserved for all build in classes (like \PHP) that
> contains all classes like exceptions. The name BaseException seems to be
> a very common one:
> https://github.com/search?l=php&q=baseexception&type=Code finds about
> 14k matches, so this may be a huge BC break if the actual class name is
> not changed.
>

It seems AbstractException is better choice for BC.

https://github.com/search?l=php&q=abstractexception&ref=searchresults&type=Code

There are 661 matches, but most of them are using namespace unlike
BaseException.


Someone proposed to use namespace for all PHP functions/classes and
clean global namespace up. This gives us flexibility also. e.g Providing
compatibility to older functions/classes to mitigate BC impact.

Use of namespace is BC by itself, but it may be better to consider namespace
use for internal features. We don't have much time, so it may be for PHP8...

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #83659 — Martin Keckeis — 2015-02-24T12:40:21+00:00

URL: https://externals.io/message/83596#83659 · In reply to: #83658

2015-02-24 13:29 GMT+01:00 Yasuo Ohgaki <yohgaki@ohgaki.net>:

> Hi all,
>
> On Tue, Feb 24, 2015 at 8:04 PM, Dennis Birkholz <dennis@birkholz.biz>
> wrote:
>
> > […]
>
> It seems AbstractException is better choice for BC.
>
>
> https://github.com/search?l=php&q=abstractexception&ref=searchresults&type=Code
>
> There are 661 matches, but most of them are using namespace unlike
> BaseException.
>
>
> Someone proposed to use namespace for all PHP functions/classes and
> clean global namespace up. This gives us flexibility also. e.g Providing
> compatibility to older functions/classes to mitigate BC impact.
>
> Use of namespace is BC by itself, but it may be better to consider
> namespace
> use for internal features. We don't have much time, so it may be for
> PHP8...
>
>
All "none" namespaced classnames are IMO reserved for PHP....
So if you develop an application/classes you (should) always prefix a
vendor/project namesapce.

But +1 for PHP8+ for a PHP namespace. For PHP7 please do not do too much at
once.

---

## #84006 — Sebastian Bergmann — 2015-02-27T14:31:35+00:00

URL: https://externals.io/message/83596#84006 · In reply to: #83596

Am 23.02.2015 um 19:15 schrieb Nikita Popov:
> Voting on the engine exceptions RFC, which proposes to convert existing
> fatal and recoverable fatal errors into exceptions, has opened:
> 
>     https://wiki.php.net/rfc/engine_exceptions_for_php7#vote
> 
> The primary vote requires a 2/3 majority, as this is a language change.
> 
> A second vote will decide whether to use a BaseException based inheritance
> hierarchy. This vote uses a simple majority.

 I have voted yes on "Allow exceptions in the engine and conversion of
 existing fatals?" and no on "Introduce and use BaseException?" and
 would like to elaborate on the latter.

 I am sorry that I was unable to raise this concern earlier (did not
 really become aware of the RFC before it was put to the vote), but I
 would prefer the following:

   * Introduce a Throwable interface
   * Let Exception implement the Throwable interface
   * Introduce an Error class that implements the Throwable interface
   * Use Error class as base class for exceptions raised by the engine

 This would be along the lines of what Java does.

---

## #84008 — Jordi Boggiano — 2015-02-27T14:47:56+00:00

URL: https://externals.io/message/83596#84008 · In reply to: #84006

> Am 23.02.2015 um 19:15 schrieb Nikita Popov:
> > […]
>
>   I have voted yes on "Allow exceptions in the engine and conversion of
>   existing fatals?" and no on "Introduce and use BaseException?" and
>   would like to elaborate on the latter.
>
>   I am sorry that I was unable to raise this concern earlier (did not
>   really become aware of the RFC before it was put to the vote), but I
>   would prefer the following:
>
>     * Introduce a Throwable interface
>     * Let Exception implement the Throwable interface
>     * Introduce an Error class that implements the Throwable interface
>     * Use Error class as base class for exceptions raised by the engine
>
>   This would be along the lines of what Java does.

+1 on that, and as it seems the BaseException is going to pass, it might 
be good to quickly draft another RFC to amend that part.

It seems people in general favor the fact that catch(Exception $e) does 
not catch those new engine exceptions, but there hopefully would not be 
much resistance against a cleaner scheme than a BaseException class.

Also the Error (and possibly Throwable) class/interface might be put in 
a PHP namespace and then we avoid any potential BC issues, but that's 
perhaps another voting point :)

Cheers

---

## #84017 — guilhermeblanco@gmail.com — 2015-02-27T15:28:49+00:00

URL: https://externals.io/message/83596#84017 · In reply to: #84008

+1 on Sebastian's suggestion. =)

I volunteer to either update the RFC or create a new one to resolve this
once "Exceptions in the engine" passes (which looks like a reality already
to me).

Just tell me which approach I should take and I'll happily write the RFC.

[]s,



> 
>
> > […]
>
> +1 on that, and as it seems the BaseException is going to pass, it might
> be good to quickly draft another RFC to amend that part.
>
> It seems people in general favor the fact that catch(Exception $e) does
> not catch those new engine exceptions, but there hopefully would not be
> much resistance against a cleaner scheme than a BaseException class.
>
> Also the Error (and possibly Throwable) class/interface might be put in a
> PHP namespace and then we avoid any potential BC issues, but that's perhaps
> another voting point :)
>
> Cheers
>
>
>
>
> --
> 
> 
>
>


-- 
Guilherme Blanco
MSN: guilhermeblanco@hotmail.com
GTalk: guilhermeblanco
Toronto - ON/Canada

---

## #84061 — Larry Garfield — 2015-02-28T00:57:16+00:00

URL: https://externals.io/message/83596#84061 · In reply to: #84017

> +1 on Sebastian's suggestion. =)
>
> I volunteer to either update the RFC or create a new one to resolve this
> once "Exceptions in the engine" passes (which looks like a reality already
> to me).
>
> Just tell me which approach I should take and I'll happily write the RFC.
>
> []s,

The RFC is currently in voting, so editing it directly is a no-no.  A 
new, short RFC, please.  (Exception implements Throwable, Error 
implements Throwable sounds good to me.  Should we ask about 
SomeUserspaceClass implements Throwable, or will someone hit me for that?)

--Larry Garfield

---

## #84063 — Christoph Becker — 2015-02-28T01:21:02+00:00

URL: https://externals.io/message/83596#84063 · In reply to: #84006

Sebastian Bergmann wrote:

>  I am sorry that I was unable to raise this concern earlier (did not
>  really become aware of the RFC before it was put to the vote), but I
>  would prefer the following:
> 
>    * Introduce a Throwable interface
>    * Let Exception implement the Throwable interface
>    * Introduce an Error class that implements the Throwable interface
>    * Use Error class as base class for exceptions raised by the engine
> 
>  This would be along the lines of what Java does.

Note, that a Throwable interface has been already brought up a while ago[1].

[1] <http://news.php.net/php.internals/83207>

-- 
Christoph M. Becker

---

## #84068 — Sebastian Bergmann — 2015-02-28T05:40:57+00:00

URL: https://externals.io/message/83596#84068 · In reply to: #84061

Am 28.02.2015 um 01:57 schrieb Larry Garfield:
> The RFC is currently in voting, so editing it directly is a no-no.  A new,
> short RFC, please.  (Exception implements Throwable, Error implements
> Throwable sounds good to me.  Should we ask about SomeUserspaceClass
> implements Throwable, or will someone hit me for that?)

 I don't think Throwable should be implementable by userland classes.

---

## #84133 — David Zuelke — 2015-03-01T23:21:53+00:00

URL: https://externals.io/message/83596#84133 · In reply to: #84006

+1000 on this; so much better than the BaseException stuff!


> 
> 
> Am 23.02.2015 um 19:15 schrieb Nikita Popov:
> > […]
> 
> I have voted yes on "Allow exceptions in the engine and conversion of
> existing fatals?" and no on "Introduce and use BaseException?" and
> would like to elaborate on the latter.
> 
> I am sorry that I was unable to raise this concern earlier (did not
> really become aware of the RFC before it was put to the vote), but I
> would prefer the following:
> 
>   * Introduce a Throwable interface
>   * Let Exception implement the Throwable interface
>   * Introduce an Error class that implements the Throwable interface
>   * Use Error class as base class for exceptions raised by the engine
> 
> This would be along the lines of what Java does.

---

## #84146 — Dmitry Stogov — 2015-03-02T06:51:27+00:00

URL: https://externals.io/message/83596#84146 · In reply to: #84008

Please, write additional RFC if you are ready to work on it and provide
implementation.

The class hierarchy is definitely not the main part of this one.
The idea was just to make difference between Exception, EngineException and
ParseException.

Thanks. Dmirty.






> 
>
> > […]
>
> +1 on that, and as it seems the BaseException is going to pass, it might
> be good to quickly draft another RFC to amend that part.
>
> It seems people in general favor the fact that catch(Exception $e) does
> not catch those new engine exceptions, but there hopefully would not be
> much resistance against a cleaner scheme than a BaseException class.
>
> Also the Error (and possibly Throwable) class/interface might be put in a
> PHP namespace and then we avoid any potential BC issues, but that's perhaps
> another voting point :)
>
> Cheers

---

## #84416 — Pascal Martin — 2015-03-07T21:30:23+00:00

URL: https://externals.io/message/83596#84416 · In reply to: #83596

Le 23/02/2015 19:15, Nikita Popov a écrit :
> Voting on the engine exceptions RFC, which proposes to convert existing
> fatal and recoverable fatal errors into exceptions, has opened:
>
>      https://wiki.php.net/rfc/engine_exceptions_for_php7#vote

Hi,

After discussing the main proposition of this RFC with other people at 
AFUP, it appears we would be +1 (by a large margin !).

Thanks for your work!

-- 
Pascal MARTIN, AFUP - French UG
http://php-internals.afup.org/

---

## #84424 — Sebastian Bergmann — 2015-03-08T06:02:59+00:00

URL: https://externals.io/message/83596#84424 · In reply to: #83596

Am 23.02.2015 um 19:15 schrieb Nikita Popov:
> Voting is open until 2015-03-08.

 Voting ends today and it looks like the RFC will be accepted. How
 should we proceed with regards to the comments I made in

   Message-ID: <54F07FC7.8050901@php.net>
   Date: Fri, 27 Feb 2015 15:31:35 +0100

 Guilherme volunteered to create a new RFC for the Throwable interface
 immediately after this RFC is accepted. Sounds good to me :-)

---

## #84425 — Stanislav Malyshev — 2015-03-08T06:11:50+00:00

URL: https://externals.io/message/83596#84425 · In reply to: #84424

Hi!

>    Message-ID: <54F07FC7.8050901@php.net>
>    Date: Fri, 27 Feb 2015 15:31:35 +0100
> 
>  Guilherme volunteered to create a new RFC for the Throwable interface
>  immediately after this RFC is accepted. Sounds good to me :-)

I would say create the RFC :) Nothing says we should immediately rush
with implementing it in exactly the same form as the RFC says and can't
modify it - if throwable looks better, and there's a better solution
using it, we could hold a bit for this one to be accepted I think.

-- 
Stas Malyshev
smalyshev@gmail.com

---

## #84444 — Nikita Popov — 2015-03-08T18:26:50+00:00

URL: https://externals.io/message/83596#84444 · In reply to: #83596

> Hi internals!
>
> Voting on the engine exceptions RFC, which proposes to convert existing
> fatal and recoverable fatal errors into exceptions, has opened:
>
>     https://wiki.php.net/rfc/engine_exceptions_for_php7#vote
>
> The primary vote requires a 2/3 majority, as this is a language change.
>
> A second vote will decide whether to use a BaseException based inheritance
> hierarchy. This vote uses a simple majority.
>
> Voting is open until 2015-03-08.
>

This RFC has been accepted with 60 votes in favor and 2 against. The
BaseException hierarchy has been accepted with 39 in favor and 19 against.

During voting some concerns about the naming of the BaseException class
have been raised. This detail can be sorted out in a follow-up discussion -
changing this (assuming only the name is changed) is simple and only a
couple of tests need to be adjusted.

Dmitry, do you want to merge your current patch?

Nikita

---

## #84463 — David Zuelke — 2015-03-09T11:04:15+00:00

URL: https://externals.io/message/83596#84463 · In reply to: #84444

Why not wait with the merge until a consensus emerges regarding Throwable?


> 
> 
> 
> 
> > […]
> 
> This RFC has been accepted with 60 votes in favor and 2 against. The
> BaseException hierarchy has been accepted with 39 in favor and 19 against.
> 
> During voting some concerns about the naming of the BaseException class
> have been raised. This detail can be sorted out in a follow-up discussion -
> changing this (assuming only the name is changed) is simple and only a
> couple of tests need to be adjusted.
> 
> Dmitry, do you want to merge your current patch?
> 
> Nikita

---

## #84464 — Bob Weinand — 2015-03-09T11:20:19+00:00

URL: https://externals.io/message/83596#84464 · In reply to: #84463

> Am 09.03.2015 um 12:04 schrieb David Zuelke <dz@heroku.com>:
> 
> Why not wait with the merge until a consensus emerges regarding Throwable?
> 
> 
> > […]

I'd like to merge master in and finish my patches to use the EngineException too.

Also, what's the reason to delay it? The RFC only should be a tiny commit to rename and change from abstract class to interface. Whose voting will finish not before beginning of April...
Nothing significant will be changed (simple find&replace, that's probably all), but it's easier to adapt, when the changes are in earlier.

I just can repeat Nikita: Please merge it, Dmitry.

Thanks,
Bob

---

## #84465 — Dan Ackroyd — 2015-03-09T11:40:51+00:00

URL: https://externals.io/message/83596#84465 · In reply to: #84463

> Why not wait with the merge until a consensus emerges regarding Throwable?

The patch for engine exceptions is large - the longer that it is left
unmerged, the more difficult it will be to do and people's time is
valuable. It also delays finding bugs or other issues in the engine
exception patch by at least two weeks, which is about 15% of the time
until we're meant to be having an RC.

Any change in the exception hierarchy or use of interfaces should be a
small patch. Holding off on merging the engine exception patch doesn't
make it significantly easier to do.

So even though I hope we can clean up the exception hierarchy, merging
the engine exceptions is the right choice imo.

cheers
Dan

---

## #84466 — Sebastian Bergmann — 2015-03-09T12:26:27+00:00

URL: https://externals.io/message/83596#84466 · In reply to: #84465

Am 09.03.2015 um 12:40 schrieb Dan Ackroyd:
> So even though I hope we can clean up the exception hierarchy, merging
> the engine exceptions is the right choice imo.

 Sounds reasonable to me. I'm wondering, though, whether we really need
 an additional RFC for the change I suggested as nobody spoke out against
 it and several were in favor.

---

## #84467 — Dmitry Stogov — 2015-03-09T12:34:32+00:00

URL: https://externals.io/message/83596#84467 · In reply to: #84444

>
> On Mon, Feb 23, 2015 at 7:15 PM, Nikita Popov <nikita.ppv@gmail.com>
wrote:
> > […]
fatal and recoverable fatal errors into exceptions, has opened:
> > […]
inheritance hierarchy. This vote uses a simple majority.
> > […]
>
>
> This RFC has been accepted with 60 votes in favor and 2 against. The
BaseException hierarchy has been accepted with 39 in favor and 19 against.
>
> During voting some concerns about the naming of the BaseException class
have been raised. This detail can be sorted out in a follow-up discussion -
changing this (assuming only the name is changed) is simple and only a
couple of tests need to be adjusted.
>
> Dmitry, do you want to merge your current patch?

Hi,

Yes, I would prefer to merge it, because the patch is big and keeping it in
synch with master is additional overhead. Also we will able to start
converting more errors to exceptions. Please merge (I don't work today).

On the other hand, I'm agree that using Throwable interface may make sense.
If we have implementation and short RFC, I think we may start voting
immediately, because it was already discussed together with this RFC.

Thanks. Dmitry.

>
> Nikita

---

## #84803 — Sebastian Bergmann — 2015-03-15T07:07:25+00:00

URL: https://externals.io/message/83596#84803 · In reply to: #84008

Am 27.02.2015 um 15:47 schrieb Jordi Boggiano:
> quickly draft another RFC to amend that part

 So who will draft the RFC for

   * Introduce a Throwable interface
   * Let Exception implement the Throwable interface
   * Introduce an Error class that implements the Throwable interface
   * Use Error class as base class for exceptions raised by the engine

 ?

---

Next page: https://externals.io/message/83596.md?page=2
