Anonymous | Login | Signup for a new account | 11-22-2024 04:23 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | |||||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
0004522 | [Quercus] | major | always | 04-27-11 11:52 | 04-27-11 11:52 | |||||||
Reporter | tokeefe | View Status | public | |||||||||
Assigned To | ||||||||||||
Priority | normal | Resolution | open | |||||||||
Status | new | Product Version | 4.0.11 | |||||||||
Summary | 0004522: Case sensitive autoload | |||||||||||
Description |
The Quercus implementation of "class_exists()" appears to lowercase the incoming string, then pass this string to __autoload() and cache the result of __autoload. If a custom __autoload() function uses this incoming string to load a PHP file from disk -- where case can matter -- the cached __autoload result can cause issues. All subsequent attempts to call class_exists(), depending on that function to autoload the file will fail even if one later uses the correct case. To test the issue, create a file (a class) Foo/Bar/Biz.php Then create an __autoload method similar to the following e.g., 31 function __autoload($name=null) 33 { 34 $class = explode("\\", $name); 35 $class = implode("/", $class); 36 37 $path = dirname(__FILE__) . "/../.."; 38 $fullfile = "$path/$class.php"; 39 40 if(!file_exists($fullfile)) 41 throw new ClassException(ClassException::CLASS_NOT_FOUND, $name); 42 43 include_once($fullfile); 44 } Then call class_exists() with both incorrect and correct case (in that order): class_exists("Foo\Bar\biz"); class_exists("Foo\Bar\Biz"); Since the first invocation of class_exists() fails and the result is cached, the subsequent invocation will also fail until you reboot the webserver. This issue is especially evident when using a tokenized URL (input by the client) to load Controllers/Views a la Zend Framework. Temporary workaround: Do not let class_exists() attempt the __autoload by passing false as the second argument. Simply call autoload manually e.g., 117 if(! class_exists($name, false)) 118 __autoload($name); |
|||||||||||
Additional Information | ||||||||||||
Attached Files | ||||||||||||
|
There are no notes attached to this issue. |
Issue History | |||
Date Modified | Username | Field | Change |
04-27-11 11:52 | tokeefe | New Issue | |
04-30-11 07:23 | kdecherf | Issue Monitored: kdecherf |
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed. 25 unique queries executed. |