This is an old revision of the document!
PHP RFC: Throw Error in Extensions
- Version: 0.1
- Date: 2016-06-14
- Author: Aaron Piotrowski aaron@trowski.com
- Status: Voting
- First Published at: http://wiki.php.net/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.
Patches and Tests
PR: #1942