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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 02 02:01:29 2024 UTC