list($pattern, $replace) = $classPattern;
$file = $class;
- if (!is_null($replace)) {
- $file = preg_replace($pattern, $replace, $file);
+ if (!is_null($replace) &&
+ preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE)) {
+ $file_path = str_replace(array('::', '_'), '/', substr($file, 0, $matches[0][1])) .
+ $replace .
+ str_replace(array('::', '_'), '/', substr($file, $matches[0][1] + strlen($matches[0][0])));
+ } else {
+ $file_path = str_replace(array('::', '_'), '/', $file);
}
if (!is_null($replace) || preg_match($pattern, $file)) {
- $file = str_replace(array('::', '_'), '/', $file) . '.php';
$err_mask = E_ALL ^ E_WARNING;
if (defined('E_DEPRECATED')) {
$err_mask = $err_mask ^ E_DEPRECATED;
}
$oldErrorReporting = error_reporting($err_mask);
/* @TODO H4: Change back to include */
- $included = include_once $file;
+ $included = include_once $file_path . '.php';
error_reporting($oldErrorReporting);
if ($included) {
return true;
http://pear.php.net/dtd/package-2.0.xsd">
<name>Autoloader</name>
<channel>pear.horde.org</channel>
- <summary>Horde Class Autoloader</summary>
- <description>Autoload implementation and class loading manager for Horde
+ <summary>Horde Autoloader</summary>
+ <description>Autoload implementation and class loading manager for Horde.
</description>
<lead>
<name>Chuck Hagenbuch</name>
<api>beta</api>
</stability>
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>Rename to Horde_Autoloader.
+ <notes>* Bug #7856: Allow underscores in pathname.
+ * Rename to Horde_Autoloader.
</notes>
<contents>
<dir name="/">
<min>5.2</min>
</php>
<pearinstaller>
- <min>1.5</min>
+ <min>1.5.4</min>
</pearinstaller>
</required>
</dependencies>