Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56276 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70875 invoked from network); 11 Nov 2011 11:53:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Nov 2011 11:53:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.170 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.160.170 mail-gy0-f170.google.com Received: from [209.85.160.170] ([209.85.160.170:62954] helo=mail-gy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6E/3E-17932-DAC0DBE4 for ; Fri, 11 Nov 2011 06:53:17 -0500 Received: by gyg13 with SMTP id 13so3146555gyg.29 for ; Fri, 11 Nov 2011 03:53:14 -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 :content-type; bh=CVH7eSXmM+YICiYwYbxKvuOXPQIXQvZ+VxncjX3eJzw=; b=fxuRMdygQrw9dhloby6rJcf9vlk9ur267bzztEQ3iPAN6o4LRIR17hAumC8PdVsH5B UGUDH9q9T278/dO8eHmaCYVZzz3OTganV1+IR7tGZJ4uxfum09YkfLuv4bBgN14VVJ9I WbAD+bWUJbisWsP8UxISLtj4tJZuiNcCHXvFs= MIME-Version: 1.0 Received: by 10.229.29.135 with SMTP id q7mr1699328qcc.127.1321012394680; Fri, 11 Nov 2011 03:53:14 -0800 (PST) Received: by 10.229.6.202 with HTTP; Fri, 11 Nov 2011 03:53:14 -0800 (PST) In-Reply-To: <9274e90a58f9a9cffee6a2d9922e6ff9@mohiva.com> References: <9274e90a58f9a9cffee6a2d9922e6ff9@mohiva.com> Date: Fri, 11 Nov 2011 06:53:14 -0500 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Re: SPLClassLoader RFC Thoughts And Improvements From: ircmaxell@gmail.com (Anthony Ferrara) > Yes, but even in that case the autoloader would not be triggered to > load \Foo_Bar because if you already have used \Foo\Bar previously, > that would have loaded \Foo_Bar as well. Well, my original point is that what if both are not defined in the same file. It's not that far fetched of an idea. Let's say you're using Zend Framework 2. So one part of your application uses the \Zend\Registry class. Now, let's say you import a third party library that was built with a dependency on the ZF1 \Zend_Registry class. Without the require_once modification, it would fatal error since both are not in the same file (even though a later autoloader knows how to load Zend_Registry). Granted, it's a bit of a stretch, but it's not out of the realm of possibility. And considering it's trivial to avoid the error since all it takes is require_once, I think it's worth fixing... > Would it not be possible that the autoloader mechanism catch all exceptions > made by any autoloader which fails to load a class. Only if none of the > register autoloaders can load the requested class the autoloader mechanism > throws an AutoloadException with all the catched exceptions. This behaviour > should be controllable by the users environment. So if using an > autoloader(e.g. from a library) which throws an exception, but the user > doesn't use exceptions in his environment, he should be able to deactivate > the exceptions thrown by the autoloader mechanism. I think this behaviour > has the greatest advantages for both worlds. This one which needs exceptions > to shut down the application in an ordered way, and for these relying on > PHPs way to handle the autoloading error. Sure, it would be possible. But that would also be a BC break. It may be worth it (not sure), but still. An interesting idea... > Not sure debug adds much here - if the class is not found, you'll be notified > by the engine anyway, so what's the added value? I think what he was trying to do was provide an indicator of what the mapped file that it tried to load was. So not throwing the exception to show it failed, but throwing it to identify what the file path should have been. Not arguing if it's a significant need, just what was intended...