php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #47075 catch doesn't allow for an empty statement
Submitted: 2009-01-12 12:13 UTC Modified: 2014-04-16 23:28 UTC
Votes:2
Avg. Score:2.5 ± 1.5
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: p at nic dot com dot pl Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 5.2.8 OS: Irrelevant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: p at nic dot com dot pl
New email:
PHP Version: OS:

 

 [2009-01-12 12:13 UTC] p at nic dot com dot pl
Description:
------------
catch requires empty {} and not just ";"





Reproduce code:
---------------
try { statement } catch (exception); is not allowed: PHP Parse error:  syntax error, unexpected ';', expecting '{'

Expected result:
----------------
try { statement } catch (exception); should work (catch exception, do 
nothing) exactly like try { statement } catch (exception) {}; does.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-16 23:28 UTC] levim@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2014-04-16 23:28 UTC] levim@php.net
Something like this would alter the parser and need a 2/3 vote on a PHP RFC.
 [2014-04-16 23:28 UTC] levim@php.net
-Operating System: linux +Operating System: Irrelevant
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 09:01:31 2025 UTC