From: notepad at codewalkers dot com
Operating system: winXP
PHP version: 4.3.4RC1
PHP Bug Type: Directory function related
Bug description: is_dir() does not work on any folder other than the current directory
Description:
------------
say you have the folder "test" and inside "test" you have:
- images (folder)
- the_following_code.php (file)
inside the "images" folder you have some sub directories.
the_following_code will NEVER return true.
if i use !is_dir instead, it then returns the sub directories as files
instead of folders. this appears to have been an ongoing problem, perhaps
overlooked or under-explained.
Reproduce code:
---------------
function directory($dir)
{
$mydir = opendir($dir);
while(false !== ($file = readdir($mydir)))
{
if($file != "." && $file != "..")
{
if(is_dir($file))
echo "$file<br>\r\n";
elseif(is_dir($mydir.$file))
echo "$file<br>\r\n";
elseif(is_dir($mydir.$file.'/'))
echo "$file<br>\r\n";
}
}
closedir($mydir);
}
$path = '/inetpub/wwwroot/Scripts/test/images/';
directory($path);
Expected result:
----------------
i expect a list of sub dirs..
Actual result:
--------------
i get nothing.
--
Edit bug report at http://bugs.php.net/?id=25846&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25846&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25846&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25846&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25846&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25846&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25846&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25846&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25846&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25846&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25846&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25846&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25846&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25846&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25846&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25846&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25846&r=float