This is an old revision of the document!

PHP RFC: Your Title Here


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"; }

Prior art

Backward Incompatible Changes


Proposed PHP Version(s)


RFC Impact


Open Issues

Make sure there are no open issues when the vote starts!

Proposed Voting Choices

Include these so readers know where you are heading and can discuss the proposed voting options.

Patches and Tests


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)


Links to external references, discussions or RFCs

Rejected Features

Keep this updated with features that were discussed on the mail lists.

rfc/non-capturing_catches.1586162244.txt.gz · Last modified: 2020/04/06 08:37 by maxsem