Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: 1.9.2
-
Fix Version/s: 1.10.0
-
Component/s: Zend_Loader
-
Labels:None
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. ![]()
Cheers,
Rodrigo Cervone.
Issue Links
| This issue duplicates: | ||||
| ZF-6727 | Zend_Loader_Autoloader_Resource generated double slash in path name |
|
|
|
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.