Issues

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

Issue Type: Bug Created: 2009-06-14T10:45:52.000+0000 Last Updated: 2010-07-16T19:29:51.000+0000 Status: Resolved Fix version(s): - 1.10.1 (10/Feb/10)

Reporter: Yura Bogdanov (octave) Assignee: Ramon Henrique Ornelas (ramon) Tags: - Zend_Loader

Related issues: - ZF-6833

Attachments:

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:

<pre class="highlight">
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;
}

Comments

Posted by Ramon Henrique Ornelas (ramon) on 2010-07-16T17:30:18.000+0000

Resolved in version 1.10.1 see r20903.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts