Issue Details (XML | Word | Printable)

Key: ZF-101
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Matthew Weier O'Phinney
Reporter: Zend Framework
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Zend_View_Abstract::_loadClass() doesn't work with classes on the include path (TRAC#99)

Created: 21/Jun/06 09:47 PM   Updated: 05/Jul/07 02:44 PM   Resolved: 02/Nov/06 12:35 AM
Return to search "Fixed in 1.5.1"
Component/s: Zend_View
Affects Version/s: 0.1.3
Fix Version/s: 0.6.0

Time Tracking:
Not Specified

File Attachments: 1. Text File Zend_View_Abstract.patch (0.5 kB)



 Description  « Hide

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.



Zend Framework added a comment - 21/Jun/06 09:47 PM

05/28/06 16:18:19: Modified by rob.nospam@akrabat.com

  • attachment Zend_View_Abstract.patch added.

Suggested patch v1


Nick Lo added a comment - 26/Jun/06 12:55 AM

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


Nick Lo added a comment - 26/Jun/06 11:19 PM

Forget my suggestion...

 
if (include $dir . $file) {

...as this produces warnings as each _path stack is looped over


Jayson Minard added a comment - 09/Jul/06 12:42 AM

Mind looking at this for 0.2.0?


Elisamuel Resto added a comment - 30/Jul/06 10:20 PM

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.


Matthew Weier O'Phinney added a comment - 02/Nov/06 12:11 AM

Fixed in 1428


Matthew Weier O'Phinney added a comment - 02/Nov/06 12:34 AM

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:

Unable to find source-code formatter for language: php. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
$view->addScriptPath('/path/to/common/view/scripts');

Matthew Weier O'Phinney added a comment - 02/Nov/06 12:35 AM

Behaviour was intentional, and a way to do as the reporter desired already existed in the code.