Take the State of PHP 2026 Survey →

Throwable Hierarchy Policy for Extensions View as Markdown

Accepted
Authors
Tim Düsterhus timwolla@php.net, Gina Peter Banyard girgias@php.net
Date
2025-04-27
Version
1.0
Source
wiki.php.net/rfc/extension_exceptions

Vote

Accept php/policies PR #17 (Add Throwable policy) at commit cf4cfb3ea95e3a59a56a395e1fae00ff9722e0cd? closed
Yes
25
No
1
26 voters
asgrim Yes 2025-05-26 20:20
ayesh Yes 2025-05-13 14:56
beberlei Yes 2025-05-13 20:55
bwoebi Yes 2025-05-24 14:05
cpriest Yes 2025-05-19 12:40
crell Yes 2025-05-13 12:57
daniels Yes 2025-05-15 13:16
derick Yes 2025-05-13 14:01
ericmann Yes 2025-05-13 14:26
galvao Yes 2025-05-18 07:40
girgias Yes 2025-05-13 17:02
jimw Yes 2025-05-17 23:53
jwage Yes 2025-05-13 23:18
kalle Yes 2025-05-13 12:58
kguest Yes 2025-05-16 10:59
kinncj Yes 2025-05-14 00:41
levim No 2025-05-14 04:27
mbeccati Yes 2025-05-13 12:46
ocramius Yes 2025-05-26 14:14
ramsey Yes 2025-05-27 17:01
santiagolizardo Yes 2025-05-15 13:15
sergey Yes 2025-05-13 12:56
theodorejb Yes 2025-05-13 12:54
thorstenr Yes 2025-05-21 09:06
timwolla Yes 2025-05-13 12:03
weierophinney Yes 2025-05-14 14:58

Discussions on the mailing list

[VOTE] Use exceptions by default in SQLite3 extension
by BohwaZ · 6 messages

RFC text

Copied from wiki.php.net, last synchronized Oct 13, 2026 11:50 UTC

Introduction

PHP has a number of de facto rules and policies around the use of exceptions in extensions, for example not to use SPL exceptions in new code, but no official de jure policy.

Since a de facto policy depends on someone remembering the policy and bringing it up during discussion based on a collected list of random links, we intend to codify the current de facto policy in the official policies repository.

Proposal

Accept the policy in https://github.com/php/policies/pull/17.

The described policy is based on the guidelines used for the exceptions introduced in the new ext/random extension in PHP 8.2. ext/random extension is the first self-contained greenfield addition to PHP’s standard library and the first user of PHP’s Namespace Policy, which allowed for a proper and consistent API design, including the Exception hierarchy. The guidelines used for ext/random’s exception hierachy have since then been used as the basis of the RFC: More Appropriate Date/Time Exceptions RFC and the Add RFC 3986 and WHATWG compliant URI parsing support RFC, making it the current de facto policy for newly designed APIs.

Open Issues

n/a

Proposed Voting Choices

Vote: Accept php/policies PR #17 (Add Throwable policy) at commit cf4cfb3ea95e3a59a56a395e1fae00ff9722e0cd? — Yes: 25 · No: 1 (closed)

Patches and Tests

Implementation

After the project is implemented, this section should contain

  1. the version(s) it was merged into
  2. a link to the git commit(s)
  3. a link to the PHP manual entry for the feature
  4. a link to the language specification section (if any)

References