ZF-101: Zend_View_Abstract::_loadClass() doesn't work with classes on the include path (TRAC#99)
Description
http://framework.zend.com/developer/ticket/99
Zend_View_Abstract::_loadClass() calls is_readable() to find out if the particular file exists on the path.
This causes problems when you want to have a set of common view helpers for multiple projects. In my case, I use a directory called Akrabat/View/Helper as part of a tree that mirrors the ZF tree for consistency.)
My preference would be to change
if (is_readable($dir . $file)) {
to
if (Zend::isReadable($dir . $file)) {
to solve this problem.
Suggested patch attached.
Comments
Posted by Zend Framework (zend_framework) on 2006-06-21T21:47:17.000+0000
05/28/06 16:18:19: Modified by rob.nospam@akrabat.com
Suggested patch v1
Posted by Nick Lo (nicklo) on 2006-06-26T00:55:09.000+0000
Rather than make the class dependant on Zend.php how about changing...
if (is_readable($dir . $file)) { include $dir . $file;...to...
if (include $dir . $file) {...which would achieve much the same result
Posted by Nick Lo (nicklo) on 2006-06-26T23:19:43.000+0000
Forget my suggestion...
if (include $dir . $file) {...as this produces warnings as each _path stack is looped over
Posted by Jayson Minard (jayson) on 2006-07-09T00:42:45.000+0000
Mind looking at this for 0.2.0?
Posted by Elisamuel Resto (user00265) on 2006-07-30T22:20:31.000+0000
One way is explode the path and then loop through it doing a Zend::isReadable() for each path with the requested file, that is somewhat slow in my eyes, but it's the only solution I see for making this work.
Posted by Matthew Weier O'Phinney (matthew) on 2006-11-02T00:11:51.000+0000
Fixed in 1428
Posted by Matthew Weier O'Phinney (matthew) on 2006-11-02T00:34:27.000+0000
Further analysis shows that the original behaviour was intentional. addScriptPath() can be used at any point to add additional view script paths to the view object. The reporter need only have done the following:
Posted by Matthew Weier O'Phinney (matthew) on 2006-11-02T00:35:16.000+0000
Behaviour was intentional, and a way to do as the reporter desired already existed in the code.