#32771 [Opn->Asn]: is_dir() returns false for absolute path. Even if it is a folder
| From: | tony2001@php.net | Date: | Tue, 19 Apr 2005 20:06:30 +0000 |
| Subject: | #32771 [Opn->Asn]: is_dir() returns false for absolute path. Even if it is a folder | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-77924@lists.php.net to get a copy of this message | ||
ID: 32771
Updated by: tony2001@php.net
Reported By: silkensedai at online dot fr
-Status: Open
+Status: Assigned
Bug Type: *Directory/Filesystem functions
Operating System: GNU/Linux Ubuntu 5.4
PHP Version: 5.0.4
-Assigned To:
+Assigned To: wez
New Comment:
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?
Previous Comments:
------------------------------------------------------------------------
[2005-04-19 17:56:46] silkensedai at online dot fr
Also: safe mode is enabled
------------------------------------------------------------------------
[2005-04-19 17:31:26] silkensedai at online dot fr
Description:
------------
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.
Example:
$ php -r 'clearstatcache();var_dump(is_dir("/mnt/"));' bool(false)
$ php -r 'clearstatcache();var_dump(is_dir("./Templates"));'
bool(true)
$ test -d "/mnt/" && echo dir || echo not_dir
dir
$ test -d "./Templates" && echo dir || echo not_dir
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: /
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32771&edit=1