Zend Framework

Zend_Loader::isReadable finds files related to Zend/Loader.php directory (not only in include_path)

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8.2
  • Fix Version/s: 1.10.1
  • Component/s: Zend_Loader
  • Labels:
    None

Description

The problem is when I call Zend_Loader::isReadable('Db.php') it will return 'true' even if there are no 'Db.php' files in my include paths.
The reason is that fopen('Db.php', 'r', true) searches this file not only in include_path but also in dirname(_FILE_) of Zend/Loader.php file. So, it finds Zend/Db.php when you're not expecting this.

I think, this is not correct to use 'fopen' in this function.
This is my temporary implementation:

public static function isReadable($filename)
{
    if (is_readable($filename)) {
    	 return true;
    }
    foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) {
         if (is_readable($path . '/' . $filename)) {
         	return true;
         }
    }
    return false;
}

Issue Links

Activity

Hide
Ramon Henrique Ornelas added a comment -

Resolved in version 1.10.1 see r20903.

Show
Ramon Henrique Ornelas added a comment - Resolved in version 1.10.1 see r20903.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: