From: php at webfreezer dot com
Operating system: Windows XP
PHP version: 4.3.2
PHP Bug Type: Directory function related
Bug description: is_dir() always returns false on non-relative base directories
Description:
------------
Hi,
this bug has been described before however everyone seemed to make a
mistake in the report.
Create this directory/file structure in the root of drive C:
- testDir
-- Directory01
-- Directory02
-- Directory03
-- file01.txt
-- file02.txt
-- file03.txt
Then start the script below.
The BUG occurs when using a non-relative directory, i.e. an ABSOULTE
path.
The documentation states "Returns TRUE if the filename exists and is a
directory. If filename is a relative filename, it will be checked relative
to the current working directory."
It seems that a check is only performed in the current directory. If you
uncomment the chdir line everything works fine!
Please fix this reproducible bug!
(Apache 1.3.27, PHP 4.3.2)
Reproduce code:
---------------
$baseDir="c:/testDir";
function parseDir($baseDir)
{
[EMAIL PROTECTED]($baseDir);
if($handle)
{
while ($file = readdir ($handle))
{
if (is_dir($file))
{
echo $file." is a directory!<br>";
} else {
echo $file." is NOT a directory!<br>";
}
}
@closedir($handle);
}
}
//chdir("c:/testDir");
parseDir("c:/testDir");
Expected result:
----------------
. is a directory!
.. is a directory!
Directory01 is a directory!
Directory02 is a directory!
Directory03 is a directory!
file01.txt is NOT a directory!
file02.txt is NOT a directory!
file03.txt is NOT a directory!
Actual result:
--------------
. is a directory!
.. is a directory!
Directory01 is NOT a directory!
Directory02 is NOT a directory!
Directory03 is NOT a directory!
file01.txt is NOT a directory!
file02.txt is NOT a directory!
file03.txt is NOT a directory!
--
Edit bug report at http://bugs.php.net/?id=24171&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=24171&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=24171&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24171&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24171&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24171&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24171&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24171&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24171&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24171&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24171&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24171&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24171&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24171&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24171&r=gnused