php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #44147 Introduction of parameterless catch clause
Submitted: 2008-02-18 12:12 UTC Modified: 2008-02-21 01:17 UTC
From: cool_lim_lp at yahoo dot com dot sg Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.5 OS: irrelevant
Private report: No CVE-ID: None
 [2008-02-18 12:12 UTC] cool_lim_lp at yahoo dot com dot sg
Description:
------------
Feature request: is it possible to introduce the following type of 'catch' clause that is commonly available in OOP langs:


try
{
   ... do something ...
}
catch  /*Catch all exceptions. We don't need to know what is it.*/
{
   echo 'Error';
}

one reminder is that do remember to destroy the exception object that is thrown although it is not caught in a parameter.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-18 12:14 UTC] cool_lim_lp at yahoo dot com dot sg
i know it can be done 
using:

try
{
   ... do something ...
}
catch (Exception $e)
{
   echo 'error';
}

but the thing is: i don't need the $e variable and in the Zend Studio, it keeps telling me that the $e variable is not used.
 [2008-02-18 22:04 UTC] johannes@php.net
A notice in some editor is no reason to change the language.
 [2008-02-21 01:17 UTC] cool_lim_lp at yahoo dot com dot sg
its a convenience in the language
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Dec 01 03:00:01 2025 UTC