|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32771 is_dir() returns false for absolute path. Even if it is a folder
Submitted: 2005-04-19 17:31 UTC Modified: 2010-12-20 11:53 UTC
Avg. Score:4.6 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:4 (100.0%)
From: silkensedai at online dot fr Assigned: wez (profile)
Status: Not a bug Package: Safe Mode/open_basedir
PHP Version: 5.0.4 OS: GNU/Linux Ubuntu 5.4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: silkensedai at online dot fr
New email:
PHP Version: OS:


 [2005-04-19 17:31 UTC] silkensedai at online dot fr
is_dir() does not work when the folder is an absolute path.

For example is_dir('/mnt') won't work (return false).
But it works for relative path.


$ php -r 'clearstatcache();var_dump(is_dir("/mnt/"));' bool(false)
$ php -r 'clearstatcache();var_dump(is_dir("./Templates"));'
$ test -d "/mnt/" && echo dir || echo not_dir
$ test -d "./Templates" && echo dir || echo not_dir

From phpinfo(): PHP Version 5.0.4
System:	Linux louve 2.6.10-5-386 #1 Tue Apr 5 12:12:40 UTC 2005 i686
Configure Command:	'./configure' '--quiet' '--enable-cli' '--enable-cgi' '--disable-all' '--disable-rpath' '--disable-debug' '--disable-path-info-check' '--disable-magic-quotes' '--disable-posix' '--disable-short-tags' '--enable-ipv6' '--disable-static' '--disable-pcntl' '--without-pear' '--with-apxs2=/usr/bin/apxs2' '--with-mysql=/usr' '--with-mysqli=/usr/bin/mysql_config' '--with-zlib' '--with-bz2' '--with-dbx' '--with-ctype' '--with-openssl' '--with-pcre-regex' '--with-gettext' '--with-mcrypt' '--with-mhash' '--with-iconv' '--with-sqlite' '--with-sqlite-utf8' '--with-gd' '--with-jpeg-dir' '--with-png-dir' '--with-zlib-dir' '--with-xpm-dir' '--with-ttf' '--with-xsl' '--with-tsrm-pthreads' '--with-tidy' '--with-freetype-dir' '--enable-gd-native-ttf' '--enable-safe-mode' '--enable-calendar' '--enable-mbstring' '--enable-spl' '--enable-ftp' '--enable-bcmath' '--enable-sockets' '--enable-dom' '--enable-xml' '--enable-soap' '--enable-libxml' '--enable-session' '--enable-simplexml' '--enable-memory-limit'
Server API 	Apache 2.0 Handler
PHP API 	20031224
PHP Extension 	20041030
Zend Extension 	220040412 

Reproduce code:
print is_dir('/')?"dir: /":"not_dir: /";

Expected result:
dir: /

Actual result:
not_dir: /


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-19 17:56 UTC] silkensedai at online dot fr
Also: safe mode is enabled
 [2005-04-19 22:06 UTC]
is_file() does the same thing when the owner of the file is not the owner of the script.
IMO that's how safe_mode works. 
Wez, is this the expected behaviour or am I wrong?
 [2005-08-11 16:17 UTC]
Sounds like expected behaviour in safe_mode.
 [2010-12-20 11:53 UTC]
-Package: Tidy +Package: Safe Mode/open_basedir
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 11:01:25 2019 UTC