Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10866 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30204 invoked by uid 1010); 1 Jul 2004 23:33:18 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 30180 invoked by uid 1007); 1 Jul 2004 23:33:18 -0000 Message-ID: <20040701233318.30179.qmail@pb1.pair.com> To: internals@lists.php.net Date: Thu, 01 Jul 2004 17:33:15 -0600 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 216.17.133.210 Subject: handling warnings/notices as elegantly as exceptions in php5 From: cellog@php.net (Greg Beaver) Hello, It is too early to do anything concrete, but I wonder if PHP 5.1 or later could add a non-fatal version of throw to handle warnings/errors/notices. A trigger_error() that accepted an object similar to Exception would be a good solution. This way, all the benefits of the Exception class could be used in a non-fatal context, without requiring a new language construct. Overloading the function signature in this way would give complete customization, and would make the need for the hacks like PEAR_ErrorStack (however elegant) that we see all around us obsolete. user error handlers would have to append another parameter that would contain the object passed in, in order to maintain proper BC, but that would be fine. As Alan pointed out, there are no languages that provide both elegant Exception and elegant warning/notice handling, perhaps PHP5 could be the first. Thanks, Greg