rfc:throw_error_in_extensions

This is an old revision of the document!


PHP RFC: Throw Error in Extensions

Introduction

With PHP 7, most fatal and recoverable errors in the engine where changed to instead throw an instance of Error. However this change was only made in the engine. Extensions still use fatal and recoverable errors instead of throwing exceptions.

Proposal

This RFC proposes changing most conditions raising an E_ERROR or E_RECOVERABLE_ERROR errors to throw an instance of Error instead. Conditions due to memory errors or other unrecoverable errors will still remain fatal errors.

Please see PR #1942 for a complete diff of all the conditions changed to throw an Error.

Backward Incompatible Changes

Generally none, though it is possible some exceptions thrown could be unintentionally caught by code written for PHP 7. However, it is rare for Error exceptions to be caught outside of cleanup or logging, so catching these exceptions is likely desirable over a fatal error.

Proposed PHP Version(s)

PHP 7.1

Voting

A majority of 50%+1 is required to approve this RFC.

Merge patch for PHP 7.1
Real name Yes No
bwoebi (bwoebi)  
colinodell (colinodell)  
daverandom (daverandom)  
derick (derick)  
guilhermeblanco (guilhermeblanco)  
hywan (hywan)  
kalle (kalle)  
kguest (kguest)  
kinncj (kinncj)  
krakjoe (krakjoe)  
lcobucci (lcobucci)  
marcio (marcio)  
mariano (mariano)  
mrook (mrook)  
ocramius (ocramius)  
pauloelr (pauloelr)  
peehaa (peehaa)  
santiagolizardo (santiagolizardo)  
sebastian (sebastian)  
trowski (trowski)  
zimt (zimt)  
Count: 21 0

Patches and Tests

PR: #1942

References

rfc/throw_error_in_extensions.1467040449.txt.gz · Last modified: 2017/09/22 13:28 (external edit)