Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56624 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64149 invoked from network); 25 Nov 2011 10:00:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Nov 2011 10:00:41 -0000 Authentication-Results: pb1.pair.com header.from=kassner@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kassner@gmail.com; spf=pass; 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:54493] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/43-45850-8476FCE4 for ; Fri, 25 Nov 2011 05:00:40 -0500 Received: by bkbzt4 with SMTP id zt4so4269324bkb.29 for ; Fri, 25 Nov 2011 02:00:37 -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=wO0WxTWVz91sHJG+NcjZJRfq5Mw+TPXPIvGbLIMbA1M=; b=emrzR6UMNSeg0XF2SFsvw+tgQjmxUL8m6UPGlPwOX3U0D7ZqQbCH1H5zJJXUCQDYNr Hi5nPLNc/lJj7wO7dbVDiGDYcrU8xGuY1Ij5mU2ITRTBi+AeuYbf89NwXuzKr0yVKfjQ 4Ig1svKzv2Z39vQujp7bZZGp9fnmLdqJ+pCoE= Received: by 10.204.199.132 with SMTP id es4mr18673444bkb.4.1322215237344; Fri, 25 Nov 2011 02:00:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.158.1 with HTTP; Fri, 25 Nov 2011 02:00:16 -0800 (PST) In-Reply-To: References: <4ECEC513.9040706@mohiva.com> <06acba1a1c53ac9527beb807787c92aa@mohiva.com> Date: Fri, 25 Nov 2011 08:00:16 -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) If your autoloader throws an exception, you need to try/catch entire application. It doesn't sounds useful. On my view, if you want to be mailed about an autoloader fail, this have to be coded inside of your own single autoloader. On Fri, Nov 25, 2011 at 7:46 AM, Christian Kaps wrote: > Am 25.11.2011 10:34, schrieb 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. > > You can do this, but the engine triggers still a fatal error. The call "n= ew > NotExistingClass();" triggers the autoloader. The autoloader sees that th= e > class doesn't exists and continues silent. And now the engine tries to > instantiate a not existing class, which ends in a fatal error. > > >> 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 clas= s >>> couldn't be loaded. I do this by adding a try/catch block around my cod= e. >>> >>> 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 >>> 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 >>> >>> >> >> >> >> -- >> Atenciosamente, >> Rafael Kassner > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Atenciosamente, Rafael Kassner