Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55963 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76760 invoked from network); 26 Oct 2011 11:38:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Oct 2011 11:38:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=ar@ez.no; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ar@ez.no; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ez.no from 209.85.213.42 cause and error) X-PHP-List-Original-Sender: ar@ez.no X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:46243] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/46-37568-341F7AE4 for ; Wed, 26 Oct 2011 07:38:44 -0400 Received: by ywb26 with SMTP id 26so1638318ywb.29 for ; Wed, 26 Oct 2011 04:38:40 -0700 (PDT) Received: by 10.68.16.7 with SMTP id b7mr64915832pbd.131.1319629120131; Wed, 26 Oct 2011 04:38:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.221.16 with HTTP; Wed, 26 Oct 2011 04:38:20 -0700 (PDT) In-Reply-To: References: <4E208FE7.4020606@sugarcrm.com> Date: Wed, 26 Oct 2011 13:38:20 +0200 Message-ID: To: Benjamin Eberlei Cc: "guilhermeblanco@gmail.com" , David Coallier , Pierre Joye , Mike Willbanks , PHP Internals List Content-Type: multipart/alternative; boundary=bcaec5215fb7f0d38e04b03218b6 Subject: Re: [PHP-DEV] SplClassLoader From: ar@ez.no (=?UTF-8?B?QW5kcsOpIFLDuG1ja2U=?=) --bcaec5215fb7f0d38e04b03218b6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Oct 25, 2011 at 12:49 PM, Benjamin Eberlei wro= te: > I think the following two requirements should be covered by configuration > aswell: > > 1. Have the autoloader be silent, i.e. doing a file_exists() check. API > idea > $loader =3D new SplClassLoader(..., SplClassLoader::SILENT); > 2. Have a ASSERT_CLASS_EXISTS mode, i.e. after the require an > "if(!class_exists($class))" =3D> throw new LogicException("SplClassLoader > expects class $class to be in $file, but after requiring the file this > class > is still not loaded."); API here aswell "new SplCloassLoader(..., > SplClassLoader::ASSERT_CLASS_EXISTS)" > What if 5.4 enhanced class_exists() to send a second true argument (an optional argument, where default should be false) to autoloaders, then user= s wouldn't have to deal with silent vs noisy modes at all. So signature of autoload functions becomes: function load( string $className, bool $checkExistence =3D false ); In the case of splClassLoader, $checkExistence =3D false would for instance mean you would get a *E_COMPILE_ERROR *(requrie) if the class does not exis= t but does match the configured root name spaced to be handled, if the argument is true, then a bool is returned. > > greetings, > Benjamin > > On Tue, Oct 25, 2011 at 4:39 AM, guilhermeblanco@gmail.com < > guilhermeblanco@gmail.com> wrote: > > > Hi internals, > > > > For all those interested, I have updated the RFC with better > > explanation, included example implementation and also example usage. > > If you have any other wishes, doubts, etc, feel free to ask on this > > thread and I'll quickly answer here and also update the RFC > > accordingly. > > > > The url for the RFC is: https://wiki.php.net/rfc/splclassloader > > > > Cheers, > > > > On Mon, Oct 24, 2011 at 7:55 PM, David Coallier wrote: > > >> > > >> Could you open a FR at bugs.php.net and attach the patch to it > please? > > >> Could be easier to track (and the # to the RFC too :) > > >> > > > > > > Yeah I'll do that once I have the tests adjusted and once I know the > > > patch actually works as expected. > > > > > > -- > > > David Coallier > > > > > > -- > > > PHP Internals - PHP Runtime Development Mailing List > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > -- > > Guilherme Blanco > > Mobile: +55 (11) 8118-4422 > > MSN: guilhermeblanco@hotmail.com > > S=C3=A3o Paulo - SP/Brazil > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > --bcaec5215fb7f0d38e04b03218b6--