ZF-6727: Zend_Loader_Autoloader_Resource generated double slash in path name
Description
in the autoload method the return statement look like
return include $path . '/' . str_replace('_', '/', $final) . '.php';
this results in a double // the . '/' after path is not required or maybe should be checked because its results in a path require like this
application/modules/i18n/models//Example.php
Comments
Posted by old of Satoru Yoshida (yoshida@zend.co.jp) on 2009-05-22T21:28:06.000+0000
Set component and auto reassign
Posted by julien PAULI (doctorrock83) on 2009-06-12T02:54:50.000+0000
Confirmed for me. I get some "/media/www/anaskaformationZF/application/default/models/Acl///MyAcl.php" when trying new Acl_MyAcl with
Posted by Andrey Kulikov (andkul) on 2009-09-11T05:42:50.000+0000
Double slashes in path too.
For Windows its good, but for linux i have this error in path:
```
Posted by Jake McGraw (jakemcgraw) on 2009-09-29T13:21:31.000+0000
Looks like it is a counting error, changing ln 174 from:
to:
Fixes the issue.
Posted by Jeroen Keppens (amazium) on 2009-11-19T00:52:08.000+0000
Could be fixed 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.
Posted by Marco Kaiser (bate) on 2009-11-19T01:47:59.000+0000
Solution diff, please fix
Posted by Marco Kaiser (bate) on 2009-11-19T06:41:08.000+0000
correct patch
Posted by Marco Kaiser (bate) on 2009-11-20T05:11:53.000+0000
fixed in r19084
Posted by Marc Peterson (marcpeterson) on 2009-11-20T15:40:17.000+0000
This patch breaks the autoloading of custom classes in my project. I get the error:
Warning: include() [function.include]: Filename cannot be empty in C:\appliaction\svn\trunk\library\Zend\Loader\Autoloader\Resource.php on line 188 Warning: include() [function.include]: Failed opening '' for inclusion (include_path='C:\application\svn\trunk\application/models/doctrine;C:\application\svn\trunk\library;.;C:\php5\pear') in C:\application\svn\trunk\library\Zend\Loader\Autoloader\Resource.php on line 188
And the class being passed to autoload() is "Custom_Acl"
Your autoload() class does not return false. It tried to include "false" as a file. Try:
public function autoload($class) { if ( $classpath = $this->getClassPath($class) ) include $classpath; else return false; }
Posted by Adam Jensen (jazzslider) on 2009-11-20T17:57:27.000+0000
Looks like we've stumbled across the same problemĀ ...I submitted a patch almost identical to what you're suggesting earlier this afternoon at http://framework.zend.com/issues/browse/ZF-8364 . There are a few other issues that talk about the same thing too, so hopefully it'll make it in.
Posted by Marco Kaiser (bate) on 2009-11-22T23:48:07.000+0000
I fix the problem in ZF-8364.