Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56621 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57808 invoked from network); 25 Nov 2011 09:37:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Nov 2011 09:37:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=christian.kaps@mohiva.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=christian.kaps@mohiva.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mohiva.com from 80.67.18.16 cause and error) X-PHP-List-Original-Sender: christian.kaps@mohiva.com X-Host-Fingerprint: 80.67.18.16 smtprelay04.ispgateway.de Linux 2.6 Received: from [80.67.18.16] ([80.67.18.16:57955] helo=smtprelay04.ispgateway.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 86/12-45850-5C16FCE4 for ; Fri, 25 Nov 2011 04:37:10 -0500 Received: from [80.67.16.116] (helo=webmail.df.eu) by smtprelay04.ispgateway.de with esmtpa (Exim 4.68) (envelope-from ) id 1RTsDS-00041g-Nb for internals@lists.php.net; Fri, 25 Nov 2011 10:37:06 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 25 Nov 2011 10:37:06 +0100 To: In-Reply-To: References: <4ECEC513.9040706@mohiva.com> <06acba1a1c53ac9527beb807787c92aa@mohiva.com> Message-ID: X-Sender: christian.kaps@mohiva.com User-Agent: Roundcube Webmail/0.6 X-Df-Sender: Y2hyaXN0aWFuLmthcHNAbW9oaXZhLmNvbQ== Subject: Re: [PHP-DEV] Re: [RFC] Autoloader Error Handling From: christian.kaps@mohiva.com (Christian Kaps) Hi, comments inline. Am 25.11.2011 09:56, schrieb Sebastian Krebs: > Hi, > > Just to throw my 2 cent in: Im with Micheal. An application, that > tries to > access a class, that doesn't exists, is broken and a FATAL is valid. > This > application doesn't need try-catch, but a bugfix (and if it is > already > released: A better testing management). How you will be informed about that the application breaks? OK, you can do this with a good log management tool or a log server. But the easiest way is to write a mail. An other problem is that the user sees mostly a white page on a fatal error. An other advantage of the exception approach is that you can collect data from session, from request or from server and send this with the mail. With a fatal error this isn't possible. Your objection with the test management is valid. But I'd rather be insured against all accidents. The problem is that the engine allows to throw exceptions. So either we need a solution to handle all cases or it shouldn't possible to throw exceptions. The particular approaches shouldn't be the problems here. > On the other side an application, that makes use of dynamic class > names > should make use of class_exists() in any case. An exception after > calling > class_exists() is just bad, but the classloader cannot distinguish > between > the reasons, why it is called. > > 2011/11/25 Christian Kaps > >> Am 25.11.2011 08:24, schrieb Michael Wallner: >> >> On Thu, 24 Nov 2011 23:28:35 +0100, Christian Kaps wrote: >>> >>> >>>> >>>> https://wiki.php.net/rfc/**autoloader_error_handling >>>> >>>> >>> Throwing an exception or fatal error in an autoloader >>> absolutely does not make any sense in my eyes. >>> Projects doing this should step back and think a >>> minute about what they dare. >>> >>> Mike >>> >> >> Hi, >> >> how would you bring your application in a consistent state after a >> class >> couldn't be loaded. I do this by adding a try/catch block around my >> code. >> >> try { >> new Application(); >> } catch (Exception) { >> // collect data >> // send mail >> // redirect to maintenance page >> } >> >> An other question is, if the autoloader work silent and I write: >> >> new NotExistingClass(); >> >> I think in this case the engine will also trigger a fatal error. So >> in my >> eyes it is regardless of whether it trigger a fatal error in the >> autoloader >> or the autoloader works silent. Both cases ends in a fatal error. Or >> am i >> wrong here? >> >> Christian >> >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >>