Description

As a part of the problem seems to be fixable i am posting here the problem.

The is_readable is producing a PHP warning if the filename is absolute, when checking against all the include paths.
So, the checking for against include_paths should be done ONLY if the filename is relative path ! Otherwise should be skipped.

Sample below:

Warning: is_readable(): open_basedir restriction in effect. File(D:\wamp\frameworks\ZendFramework-1.10.2/D:_Work\myapp/application/modules\articles/views\helpers/HeadLink.php) is not within the allowed path(s): (D:_Work\;D:\wamp\;C:\Windows\Temp\;c:\php5\pear) in D:\wamp\frameworks\ZendFramework-1.10.2\Zend\Loader.php on line 190

A quick (maybe not the best) fix would be to actually check the parent

public static function isReadable($filename)
{
if (is_readable($filename)) { // Return early if the filename is readable without needing the // include_path return true; }

Comments

Posted by Cristian Bichis (avantis) on 2010-03-17T02:45:30.000+0000

Pasting same error again:

Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(D:\wamp\frameworks\ZendFramework-1.10.2/D:/_Work/myapp/application/modules/articles/views\helpers/HeadTitle.php) is not within the allowed path(s): (D:_Work\;D:\wamp\;C:\Windows\Temp\;c:\php5\pear) in D:\wamp\frameworks\ZendFramework-1.10.2\Zend\Loader.php on line 190

Posted by Cristian Bichis (avantis) on 2010-03-17T02:46:26.000+0000

So i think before somehow the error text got screwed before i pasted here.

So the error is still present...

Posted by Cristian Bichis (avantis) on 2010-03-19T01:08:01.000+0000

Andrew Ballard posted a sample case on fw-general illustrating the problem (at least on Windows). I was to do myself a sample case but i think Andrew sample case is more than relevant, and very easy to reproduce so i am posting here:

While this is not critical (the script will continue to work), it's clearly going to be an issue if you are running the code in production on a Windows machine. However, making the changes as suggested by the reporter do not remove the warning for me -- the warning remains exactly as before. I'll see if I can find a patch today, but at this point, I'm applying guesswork.

Posted by Andrew Ballard (aballard) on 2010-04-27T09:35:06.000+0000

Matthew,

Does the proposed change I added in my comment on the related issue http://framework.zend.com/issues/browse/ZF-9263 help any? Basically, if you know the OS is Windows and the path being tested begins with a drive letter, then you also know that the path being tested is absolute and there is no point in iterating through the include paths.