Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56627 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69326 invoked from network); 25 Nov 2011 10:15:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Nov 2011 10:15:33 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.170 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.216.170 mail-qy0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:47399] helo=mail-qy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/44-45850-4CA6FCE4 for ; Fri, 25 Nov 2011 05:15:32 -0500 Received: by qyk33 with SMTP id 33so2584982qyk.29 for ; Fri, 25 Nov 2011 02:15:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=LYkkFc4fQuBhMGnoEUCgAShfz0UOxGxMANJEL0/q8oQ=; b=dZFFYs3RMa6PYbJ/zXInMhL9hdrLxvfSt+3SG4XAKeytTBBJLcW4uWy98f88rEY6ys uv5iGpWGuWL0EyGgsVBdNqih6vp0YMigO2ZjmvprshvAhOiiHBMjg9pR6+p0PONweCA7 fLrSjKqWasKlJV9ChwWBlv65ZN6jVDf/SuZ/4= MIME-Version: 1.0 Received: by 10.229.101.93 with SMTP id b29mr3699620qco.110.1322216128810; Fri, 25 Nov 2011 02:15:28 -0800 (PST) Received: by 10.229.38.134 with HTTP; Fri, 25 Nov 2011 02:15:28 -0800 (PST) In-Reply-To: References: <4ECEC513.9040706@mohiva.com> <06acba1a1c53ac9527beb807787c92aa@mohiva.com> Date: Fri, 25 Nov 2011 11:15:28 +0100 Message-ID: To: Sebastian Krebs Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=001636499237ac8ecc04b28c6e59 Subject: Re: [PHP-DEV] Re: [RFC] Autoloader Error Handling From: tyra3l@gmail.com (Ferenc Kovacs) --001636499237ac8ecc04b28c6e59 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The problem with fatal, that you have no way (by the standard means, but you can somehow manage it through the usage of output buffers or register_shutdown_function, but thats ugly, and can change in the future) to intercept and gracefully terminate your application, which is an often needed feature. AFAIK E_FATAL should be only used where the engine is left in an unstable state, which isn't really true here. So I think that E_RECOVERABLE_ERROR would be more appropriate here, and in general we use E_ERROR many places where E_RECOVERABLE_ERROR would be more suitable, but thats another topic. For clarification: I'm talking about the E_FATAL which currently will be called if none of the registered autoloaders were able to load the requested class. On Fri, Nov 25, 2011 at 9:56 AM, Sebastian Krebs wrote: > Hi, > > Just to throw my 2 cent in: Im with Micheal. An application, that tries t= o > 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). > 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 betwee= n > 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< > 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 clas= s > > couldn't be loaded. I do this by adding a try/catch block around my cod= e. > > > > 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 > > > > > --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --001636499237ac8ecc04b28c6e59--