ZF-8109: Zend_Loader_Autoloader_Resource::autoload

Description

This method will fail getting the right path because it is adding two slashes at the beginning of the name of the file.

In the method, where it reads (line 176): return include $path . '/' . str_replace('', '/', $final) . '.php'; it must be return include $path . str_replace('', '/', $final) . '.php';

also, I noticed that in the same method in the line 159 that it reads $final = array_pop($segments); but in the line 174 $final = substr($class, strlen($lastMatch));

this is overriding the previous line, so another possibly solution to this is return include $path . '/' . $final . '.php';

Anyway, this is not a good practice in the code. :D

Cheers, Rodrigo Cervone.

Comments

Removing the slash there is not a good solution, that way you expect both other parts to have a slash.

I'd suggest a fix by changing:

return include $path . '/' . str_replace('_', '/', $final) . '.php';

to:

return rtrim(include $path, '/') . '/' . ltrim(str_replace('_', '/', $final), '/') . '.php';

That way you remove right trailing slashes from the path and left trailing slashes from the final bit.

fixed with ZF-6727