Edit report at http://bugs.php.net/bug.php?id=54419&edit=1

 ID:                 54419
 Updated by:         d...@php.net
 Reported by:        david dot macek dot 0 at gmail dot com
 Summary:            is_dir() called on file with trailing slash to throw
                     warning if open_basedir
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Safe Mode/open_basedir
 Operating System:   Windows 7, Debian
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is expected behaviour. A non path that doesn't exists (the one with the 
slash) is considered outside of the basedir.


Previous Comments:
------------------------------------------------------------------------
[2011-03-29 21:08:10] david dot macek dot 0 at gmail dot com

Description:
------------
is_dir throws an error if:

- open_basedir is in effect

- called upon a file

- the path is terminated with a slash



CLI Tested on Windows:

php -d open_basedir=/ -r "var_dump(is_dir('C:/Windows/write.exe'));"

#bool(false)

php -d open_basedir=/ -r "var_dump(is_dir('C:/Windows/write.exe/'));"

#warning



CLI Not tested on Linux, should be like this:

php -d open_basedir=/ -r "var_dump(is_dir('/etc/fstab'));"



Apache2 module tested on Debian, see test script.

Test script:
---------------
<?php



echo PHP_VERSION . PHP_EOL;

ini_set('display_errors', true);

error_reporting(E_ALL);

var_dump(is_dir(__FILE__ . '/'));



Expected result:
----------------
5.2.9-0.dotdeb.1 bool(false)

Actual result:
--------------
5.3.5-0.dotdeb.0

Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. 
File(/var/www/vhosts/blah/subdomains/bleah/httpdocs/phpinfo.php/) is not within 
the allowed path(s): (/var/www/vhosts/blah/subdomains/bleah/httpdocs:/tmp) in 
/var/www/vhosts/blah/subdomains/bleah/httpdocs/phpinfo.php on line 7

bool(false)


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54419&edit=1

Reply via email to