php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54419 is_dir() called on file with trailing slash to throw warning if open_basedir
Submitted: 2011-03-29 21:08 UTC Modified: 2011-06-10 04:03 UTC
Votes:6
Avg. Score:4.7 ± 0.7
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.0%)
Same OS:1 (20.0%)
From: david dot macek dot 0 at gmail dot com Assigned:
Status: Not a bug Package: Safe Mode/open_basedir
PHP Version: 5.3.6 OS: Windows 7, Debian
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: david dot macek dot 0 at gmail dot com
New email:
PHP Version: OS:

 

 [2011-03-29 21:08 UTC] 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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-10 04:03 UTC] dsp@php.net
-Status: Open +Status: Bogus
 [2011-06-10 04:03 UTC] dsp@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Feb 08 21:01:29 2025 UTC