ZF-11125: isReadable in Zend_Loader should detect absolute links in linux as well to avoid looping on include_path directories

Description

Zend_Loader isReadable can generate a lot of basedir restrictions warnings when searching for all available availability of some files. A big thread on it on #ZF-9263. This is annoying because of the warnings it cangenerate but it is as well annoying as it means a lot of inpout-output are made even with absolute paths. Now the code contain an absolute path detecter for Windows:


        if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'
            && preg_match('/^[a-z]:/i', $filename)
        ) {
            // If on windows, and path provided is clearly an absolute path,
            // return false immediately
            return false;
        }

Fine, for windows if the path is absolute and file is not found with this path we do not try all include_path directories with the given path. Now On Linux this loop is always done, that means for example all default Ressource Controllers tested by a basic Zend_Application Bootstrap will get checked on all directories of the include_path (and generate warning if we use open_basedir -- and disabling open_basedir is not a real solution).

Now since previous version of ZF I've always used absolute path for my includes to get finest apc optimization on require_once and include_once. So I'm really dispointed when I see all my absolute paths tested on every include_path.

On some of the comments of bug #ZF-9263 I saw that on Linux absolute path detection was impossible, well, if effectively /include/path//my/path works as /include/path/my/path the basic usage of paths on Linux is that if I ask for "/my/path" it's absolute and "my/path" is relative. So, if my string start by "/" it should be considered as an absolute path. If it's not an absolute path then it means the code using Zend_Loader is wrong, but please do not decrease overall performance by adding a lot of input-ouptut calls where some nice absolute paths have been built by a nice application.

Comments

No comments to display