[dev] Fwd: include vs include_once in Horde_Autoloader

Michael M Slusarz slusarz at horde.org
Tue Aug 4 21:12:33 UTC 2009


Quoting Michael Rubinsky <mrubinsk at horde.org>:

> Quoting Chuck Hagenbuch <chuck at horde.org>:
>
>> Anything being the same? Or when our classes aren't properly  
>> namespaced yet? If the latter, we should just fix our classes. If  
>> the former, well that sucks.
>
> It sucks.
>
> The specific issue is with classes located in the root of the lib/  
> directory. i.e. Kronolith_Day is defined in the file  
> kronolith/lib/Day.php. If kronolith was at any time pushed on the  
> stack during the current request, then kronolith/lib is present in  
> the include_path. The result of this is that something like:
> <code>
> if (class_exists('Day')) {
> ...
> }
> </code>
>
> in an external library will result in kronolith/lib/Day.php being included.

That should be simple enough to fix.  We should change this in Registry.php:

Horde_Autoloader::addClassPath($app_lib);
Horde_Autoloader::addClassPattern('/^' . $app . '_/i', $app_lib);

to this:

Horde_Autoloader::addClassPattern('/^' . $app . '[$_]/i', $app_lib);

michael

-- 
___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the dev mailing list