Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51504 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76849 invoked from network); 23 Feb 2011 03:04:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2011 03:04:53 -0000 Authentication-Results: pb1.pair.com header.from=pencap@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=pencap@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pencap@gmail.com X-Host-Fingerprint: 209.85.215.170 mail-ey0-f170.google.com Received: from [209.85.215.170] ([209.85.215.170:55599] helo=mail-ey0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 21/40-09682-259746D4 for ; Tue, 22 Feb 2011 22:04:51 -0500 Received: by eyf5 with SMTP id 5so1332509eyf.29 for ; Tue, 22 Feb 2011 19:04:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=C4y9fC+YJKjHvXXpjV0kefWwzrr6TCARmHuGRHtCjNo=; b=dPZZj42Lu3k0lphlV1So0ELsb/cBTJNsA76fFxnh3I553LEfGPO1DDwhdoyJ0AS9Fu kW2mj3wvcKRoorIGot+PiU68c2JXT4ghQw7V0nsQ8ah6WFN1rj0jrQBIdUQCi2o0K3nu 5a/fbM7y9RSF+F2znPvLabglWObOKQj/hQo0A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=q6UugBG4ZhY3VPi3q87utYfHaer39q5+t7t1nXGDvzcin5CMsShQ8GnKeLwuYMe2hX LpqasxEpbXTb5AOquw8wfpvfC2uZKkwPR9HCVSjrjUfKwDsBiulbRvQ6cpF1Bq+V/5h5 8XvCFdTDYoCdulbd61J2qrI1hrl7EPvQCjKg4= MIME-Version: 1.0 Received: by 10.213.3.74 with SMTP id 10mr104077ebm.97.1298430287666; Tue, 22 Feb 2011 19:04:47 -0800 (PST) Received: by 10.213.113.137 with HTTP; Tue, 22 Feb 2011 19:04:47 -0800 (PST) In-Reply-To: References: <4F372AC9-7C88-43E5-BCE1-58B5BFD34135@easen.co.uk> <09CA4F51-E610-4070-ACF0-A35E8BE5EF1D@easen.co.uk> Date: Tue, 22 Feb 2011 21:04:47 -0600 Message-ID: To: =?UTF-8?B?QW5kcsOpIFLDuG1ja2U=?= Cc: Marc Easen , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Re: [PATCH] Bug #49852 & Bug #53065 - Adding spl_autoload_case_sensitivity() From: pencap@gmail.com (Mike Willbanks) I think it would be better just to fix the issue in the code. If you run include 'My/Path/To/File.php' does it lowercase it? It does not. The expected behavior would to not lowercase it. There are ways that this could be fixed directly in the code. The only real requirement that it looks like the need for lowercase is for the hash table that is internally maintained by spl_autoload for the loading of classes. To fix this w/o a BC break and give the expected behavior, it could look for the class first by lowercasing the path and then secondarily look by the correct case (or the opposite). The only real usefulness of the default behavior is for windows users whereas the majority of installs is on *nix platforms. The other way (and cleaner IMO) than the current patch if the above wouldn't work is to add a forth parameter to spl_autoload_register to tell it to by type sensitive. The only BC break that is really possible here is for *nix users that are expecting it to always be lowercase, however, this seems to be more or less an edge case and should ultimately just be fixed. I have not seen one project that utilizes the spl_autoload default functionality since their class naming structure generally consists of upper and lowercase letters. To keep consistency it could certainly be a boolean with the function declaration of (keeping BC of course): bool spl_autoload_register ([ callback $autoload_function [, bool $throw = true [, bool $prepend = false [, bool $case_sensitive = false ]]]] ) I can build a patch for this route if someone would like... I just think that instead of the SplClassLoader proposal something also needs to happen with the spl_autoload area as well. Regards, Mike > Wouldn't it be better to join forces with the SplClassLoader proposal[1]? > A C implementation of PSR-0 has been prpoposed [2] as well, and would be > nice to get something like that into 5.next > > However for your imminent performance needs, you should be aware that an > hash map based autoloaders can be fast as well [3]. > > > [1] http://wiki.php.net/rfc/splclassloader > [2] http://blog.runpac.com/post/splclassloader-php-extension-benchmarks > [3] > http://weierophinney.net/matthew/archives/245-Autoloading-Benchmarks.html > > Best > ar > > > On Wed, Jan 12, 2011 at 11:53 PM, Marc Easen wrote: > >> Hello again, >> >> Has anyone had a chance to look at my patch? >> >> Forgive me for being quite eager to get this into trunk, as it will improve >> the performance of all PHP Frameworks which currently implement their own >> autoloader method due to the oddities of the SPL autoloader. >> >> >> >> Kind Regards >> Marc >> >> >> On 26 Dec 2010, at 13:20, Marc Easen wrote: >> >> Hello everyone, >> >> Firstly I would like to introduce myself, my name is Marc Easen and I've >> working with PHP for past 6 years or so. I'm really excited to see where PHP >> is going with the addition of namespaces and now traits, and hopefully I'm >> able to contribute back to PHP community. >> >> I've currently working on a high performance PHP Framework based on version >> 5.3.3+ (5.3.99-dev for traits). Due to the high performance nature of this >> framework I've been looking at ways of improving the loading of the classes. >> It seems by default the spl_autoload() function lowercases the class name >> before trying to locate the file, a couples of users have reported this >> previously and have requested a fix (bug #49852 >> http://bugs.php.net/bug.php?id=49852 & bug #53065 >> http://bugs.php.net/bug.php?id=53065). spl_autoload() lower casing the >> class names when it is trying to locate the file does not work on *nix based >> system in a lot of PHP Frameworks - Zend Framework being on of them. >> >> Understanding the requirement to support backwards compatibility both >> submitters suggested implementing a spl_autoload_case_sensitivity() >> function. The patch I have attached adds such a function to the SPL >> extension. The patch is against trunk (r306670), it also includes phpt tests >> for this function. >> >> Please could someone review this patch and let me know what you think. >> >> Kind Regards, >> >> Marc >> >> >> >> >> >