[dev] Fwd: include vs include_once in Horde_Autoloader

Michael M Slusarz slusarz at horde.org
Tue Aug 4 21:30:32 UTC 2009


Quoting Michael Rubinsky <mrubinsk at horde.org>:

>> Horde_Autoloader::addClassPattern('/^' . $app . '[$_]/i', $app_lib);
>
> This results in the application's base class not being loadable.  
> i.e. Kronolith::

Why not?  Oh, square brackets only match characters, not special  
pattern.  D'oh.  This should be correct:

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

Sure enough, it works:

preg_match('/^kronolith(?:$|_)/i', 'Kronolith_Test', $matches);
print_r($matches);
Array
(
     [0] => Kronolith_
)


preg_match('/^kronolith(?:$|_)/i', 'Kronolith', $matches);
print_r($matches);
Array
(
     [0] => Kronolith
)

michael

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



More information about the dev mailing list