| alcaeus | Yes | 2020-05-11 10:39 |
| asgrim | Yes | 2020-05-13 14:02 |
| ashnazg | Yes | 2020-05-13 12:10 |
| beberlei | Yes | 2020-05-23 13:34 |
| bmajdak | Yes | 2020-05-10 17:06 |
| bwoebi | Yes | 2020-05-10 10:26 |
| carusogabriel | Yes | 2020-05-11 11:02 |
| cmb | Yes | 2020-05-10 13:04 |
| dams | Yes | 2020-05-11 13:26 |
| dmitry | Yes | 2020-05-18 08:41 |
| duncan3dc | Yes | 2020-05-10 11:45 |
| ekin | Yes | 2020-05-13 20:51 |
| galvao | Yes | 2020-05-10 15:55 |
| geekcom | Yes | 2020-05-15 03:17 |
| jasny | Yes | 2020-05-15 13:44 |
| jbnahan | Yes | 2020-05-11 05:07 |
| jhdxr | Yes | 2020-05-10 21:55 |
| kalle | Yes | 2020-05-10 11:17 |
| kelunik | Yes | 2020-05-19 21:09 |
| kguest | Yes | 2020-05-10 08:41 |
| kocsismate | Yes | 2020-05-10 18:06 |
| levim | Yes | 2020-05-18 02:06 |
| lstrojny | Yes | 2020-05-15 11:47 |
| marandall | Yes | 2020-05-10 18:39 |
| marcio | Yes | 2020-05-15 22:06 |
| mariano | Yes | 2020-05-10 11:14 |
| mbeccati | Yes | 2020-05-13 07:09 |
| mcmic | Yes | 2020-05-13 09:54 |
| mike | Yes | 2020-05-12 13:12 |
| nicolasgrekas | Yes | 2020-05-13 13:59 |
| nikic | Yes | 2020-05-11 09:17 |
| ocramius | Yes | 2020-05-13 09:15 |
| pierrick | Yes | 2020-05-18 19:07 |
| pmjones | Yes | 2020-05-10 23:05 |
| pmmaga | Yes | 2020-05-11 12:43 |
| pollita | Yes | 2020-05-15 14:32 |
| rtheunissen | Yes | 2020-05-15 19:55 |
| ruudboon | Yes | 2020-05-16 16:51 |
| salathe | Yes | 2020-05-22 09:29 |
| santiagolizardo | Yes | 2020-05-15 13:21 |
| sergey | Yes | 2020-05-10 08:35 |
| sirsnyder | Yes | 2020-05-11 01:03 |
| svpernova09 | Yes | 2020-05-15 12:40 |
| tandre | Yes | 2020-05-10 14:00 |
| trowski | Yes | 2020-05-21 17:16 |
| wjx | No | 2020-05-11 04:02 |
| wyrihaximus | Yes | 2020-05-14 10:57 |
| yunosh | Yes | 2020-05-11 07:01 |
| zimt | Yes | 2020-05-15 08:44 |
Copied from wiki.php.net, last synchronized Oct 13, 2026 11:51 UTC
Currently, PHP requires to capture the exception being caught to a variable:
try {
foo();
} catch (SomeException $ex) {
die($ex->getMessage());
}
However, you need to specify the variable even if it's not used:
try {
changeImportantData();
} catch (PermissionException $ex) {
echo "You don't have permission to do this";
}
Someone reading the above code is left to wonder if the author intended to not use the exception variable or it's a bug.
Allow catching exceptions without capturing them to variables:
try {
changeImportantData();
} catch (PermissionException) { // The intention is clear: exception details are irrelevant
echo "You don't have permission to do this";
}
Such change was first proposed in this RFC 7 years ago. It was turned down mostly because it also wanted to allow blanket catches like this:
try {
foo();
} catch {
bar();
}
Meanwhile what I'm proposing here has received mostly positive feedback so I feel it's worth revisiting.
None.
8.0
None.
Voting started on 2020-05-10 and will end on 2020-05-24 at 9:00 UTC.
Vote: Accept this RFC? — Yes: 48 · No: 1 (closed)
* https://github.com/php/php-src/pull/5345
After the project is implemented, this section should contain
* https://externals.io/message/109550 - initial announcements
Keep this updated with features that were discussed on the mail lists.