Zend Framework

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

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 0.1.3
  • Fix Version/s: 0.6.0
  • Component/s: Zend_View
  • Labels:
    None

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.

Activity

Hide
Zend Framework added a comment -

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

  • attachment Zend_View_Abstract.patch added.

Suggested patch v1

Show
Zend Framework added a comment - 05/28/06 16:18:19: Modified by rob.nospam@akrabat.com
  • attachment Zend_View_Abstract.patch added.
Suggested patch v1
Hide
Nick Lo added a comment -

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

Show
Nick Lo added a comment - 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
Hide
Nick Lo added a comment -

Forget my suggestion...

 
if (include $dir . $file) {

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

Show
Nick Lo added a comment - Forget my suggestion...
 
if (include $dir . $file) {
...as this produces warnings as each _path stack is looped over
Hide
Jayson Minard added a comment -

Mind looking at this for 0.2.0?

Show
Jayson Minard added a comment - Mind looking at this for 0.2.0?
Hide
Elisamuel Resto added a comment -

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.

Show
Elisamuel Resto added a comment - 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.
Hide
Matthew Weier O'Phinney added a comment -

Fixed in 1428

Show
Matthew Weier O'Phinney added a comment - Fixed in 1428
Hide
Matthew Weier O'Phinney added a comment -

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');
Show
Matthew Weier O'Phinney added a comment - 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');
Hide
Matthew Weier O'Phinney added a comment -

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

Show
Matthew Weier O'Phinney added a comment - Behaviour was intentional, and a way to do as the reporter desired already existed in the code.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: