ZF-8109: Zend_Loader_Autoloader_Resource::autoload

Issue Type: Bug Created: 2009-10-20T16:23:40.000+0000 Last Updated: 2009-11-25T00:28:54.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Rodrigo Cervone (chervox) Assignee: Marco Kaiser (bate) Tags: - Zend_Loader

Related issues: - ZF-6727



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.


Posted by Jeroen Keppens (amazium) on 2009-11-19T00:55:48.000+0000

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';


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.

Posted by Marco Kaiser (bate) on 2009-11-23T05:00:35.000+0000

fixed with ZF-6727

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.