Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56620 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56340 invoked from network); 25 Nov 2011 09:34:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Nov 2011 09:34:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=kassner@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=kassner@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: kassner@gmail.com X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:63323] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/C1-45850-2316FCE4 for ; Fri, 25 Nov 2011 04:34:42 -0500 Received: by bkbzt4 with SMTP id zt4so4238712bkb.29 for ; Fri, 25 Nov 2011 01:34:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=NFmaVfCDAbOLsPPzmo0TGffN/4G5BjlWKCtcGY+f3co=; b=Cu4sPgZwHn2mH6eFC8T91b8JUFYqbnCexaXXEkpByLYIyvvtyMD3dlaSFKSh02AJcr 6gAh5QPRixVDEUlYgfcBrCZ4cyJQE5YUXvM3jqINEhxSZlsz28pr0ZzghBCqWLNws++U YrL6YMwowQEx9p5kjrKHsWgT9KhhWJNOGi8vU= Received: by 10.205.127.77 with SMTP id gz13mr19170720bkc.76.1322213679090; Fri, 25 Nov 2011 01:34:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.158.1 with HTTP; Fri, 25 Nov 2011 01:34:15 -0800 (PST) In-Reply-To: <06acba1a1c53ac9527beb807787c92aa@mohiva.com> References: <4ECEC513.9040706@mohiva.com> <06acba1a1c53ac9527beb807787c92aa@mohiva.com> Date: Fri, 25 Nov 2011 07:34:15 -0200 Message-ID: To: Christian Kaps Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: [RFC] Autoloader Error Handling From: kassner@gmail.com (Rafael Kassner) I think an autoloader can't be raise any kind of error. If the class will be loaded by another autoloader on the stack and the first throws an Exception, this will be a wrong behavior. Indeed, if autoloader can't include the class, PHP throws a fatal error, and you can avoid it using class_exists function that calls autoloader by its own. On Fri, Nov 25, 2011 at 6:06 AM, Christian Kaps wrote: > 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 { > =A0 =A0new Application(); > } catch (Exception) { > =A0 =A0// collect data > =A0 =A0// send mail > =A0 =A0// 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 autoload= er > 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 Atenciosamente, Rafael Kassner