RE: [PHP-DEV] [VOTE] Allowing use of exceptions in the engine

From: Date: Sun, 08 Dec 2013 13:55:04 +0000
Subject: RE: [PHP-DEV] [VOTE] Allowing use of exceptions in the engine
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-70532@lists.php.net to get a copy of this message
Nikita, Apologies for not having followed the discussion a few weeks ago but I think this proposal can't be accepted as it is even if everyone likes it. It breaks a very basic design concept in the way both the engine code as well as extension code is written - execution will never resume beyond an E_ERROR. Allowing execution to resume (through the use of exceptions) opens a huge can of worms, and sets expectations we can't meet. In fact, the main difference between E_ERROR and E_WARNING is the recoverability, so this is not some small detail we can fix - we simply can't assume execution can continue after an E_ERROR is triggered, because E_ERROR in its very essence implies no-resumed-execution. That's also the reason error handlers (that existed before exceptions did) don't handle E_ERROR. I don't think a vote makes a lot of sense here, since it's asking people whether they're in favor of the concept of being able to recover from any kind of error. That's the wrong question (to which, by the way, I'd vote 'yes'). The real question is whether people are OK that the engine will start randomly crashing through the use of standard PHP code, which is pretty much out of the question. If there are E_ERROR's which you think are erroneously tagged as E_ERROR's and should in fact be E_RECOVERABLE_ERROR, we should change them, rather than assuming that E_ERRORs can be tagged as recoverable wholesale... Disclaimer: Perhaps I'm missing something. I also asked Dmitry to take a closer look at this... Zeev > -----Original Message----- > From: Nikita Popov [mailto:nikita.ppv@gmail.com] > Sent: Saturday, December 07, 2013 2:58 PM > To: PHP internals > Subject: [PHP-DEV] [VOTE] Allowing use of exceptions in the engine > > Hi internals! > > I opened the vote on the "Exceptions in the engine" RFC: > > https://wiki.php.net/rfc/engine_exceptions#vote > > The vote has three options, "Yes", "No" and "Yes, without > E_RECOVERABLE_ERROR changes". The last option is a version of the > proposal without BC issues. > > Some further notes: > * I will not be including something like BaseException. Introducing it for this > purpose seems like bad design and will be very hard to get rid of in the > future. As the proposal (without recoverable errors) does not break BC [1] > even without it, I don't see a reason to introduce it. > * Some people suggest to use different subclasses of EngineException for > different error types. I'm not against that, but I think it's okay to do that in a > separate proposal, if someone can come up with a good selection of > exception classes. It's much easier (and does not break BC) to add > subclassing later, than to add suboptimal subclass types now and try to fix > something like the SPL exception mess later. > * The suggested uncaught exception error message change is just a bit of > cosmetics (and not directly related to this proposal), so I'd like to do that > separately. > > And regarding the vote: If you are in favor of the proposal in general, but > want to have it in PHP 6 rather than PHP 5.6, then vote "No" here. If it fails > now, someone can revive this once the time for PHP 6 has come. > > Thanks, > Nikita > > [1]: We don't have a formal definition for this, but it seems to be general > consensus that relaxing error conditions does not constitute a backwards > compatibility break.

« previous php.internals (#70532) next »