Table of Contents

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.

Below is a list of extensions and what conditions were changed to throw an instance of Error instead of a fatal or recoverable 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.

Voting opened on 2016-06-27 at 4:00 pm GMT and will remain open until 2016-07-04 at 11:59 pm GMT

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)  
Final result: 21 0
This poll has been closed.

Patches and Tests

PR: #1942

References

Exceptions in the engine (for PHP 7)