ID: 31377
Updated by: [EMAIL PROTECTED]
Reported By: intro at intro dot one dot pl
-Status: Open
+Status: Bogus
Bug Type: Directory function related
Operating System: linux
PHP Version: 5CVS-2005-01-02
New Comment:
>does "is_dir" function schould display a symbolic
>links (but only to some directory) as dir ??
is_dir() resolves symlinks.
No bug, just a user mistake -> bogus.
Previous Comments:
------------------------------------------------------------------------
[2005-01-10 22:12:43] intro at intro dot one dot pl
"Try is_dir($directorytoread.'/'.$file) first."
... yes it is true, i could try it earlier :-). This works correctly,
but with one thing: does "is_dir" function schould display a symbolic
links (but only to some directory) as dir ?? Doesn't do it "is_link"
function (where it shows symbolic links to directory too) ??
when function filetype works in any way correctly.
Regards
------------------------------------------------------------------------
[2005-01-10 21:34:49] [EMAIL PROTECTED]
Try is_dir($directorytoread.'/'.$file) first.
------------------------------------------------------------------------
[2005-01-02 19:00:41] intro at intro dot one dot pl
Hmmmm i've done something else. Function filetype. And after use
filetype on some folder i have many warnings that "Lstat failed for
file". And the same way i think works "is_dir". Only a few files and
folders are with no this warning and is showing as dir or file etc. The
same is on other functions as is_file etc. My last code in tests:
<?php
$directorytoread = "/home"
$files=scandir($directorytoread);
$listdirindir = array();
// var_dump($files);
// all files are listing which is in folder /home
foreach ($files as $file)
{
if ( filetype($file) == "dir" )
echo "File \"$file\" is dir and ";
if (is_dir($file))
{
array_push($listdirindir,$file);
echo "dir \"$file\" added<br/>";
}
}
print_r($listdirindir);
?>
...and my examples result is:
many of warnings +
File "." is dir and dir "." added
File ".." is dir and dir ".." added
+ many of warnings +
File "c" is dir and dir "c" added
+ many of warnings +
Array ( [0] => . [1] => .. [2] => c )
------------------------------------------------------------------------
[2005-01-02 12:14:33] intro at intro dot one dot pl
by "var_dump($files);" after scandir everything are listing good.
Permissions etc. is ok and files and folders are readable. I checked
some others dirs and sometimes files is showing as dir (for example
.directory and others hidden files).
"Please try using this CVS snapshot:" still doesn't work correctly.
------------------------------------------------------------------------
[2005-01-02 07:45:53] [EMAIL PROTECTED]
Please try using this CVS snapshot:
http://snaps.php.net/php5-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.0-win32-latest.zip
Also, add 'var_dump($files);' after the scandir() line and check the
output. (permissions..?)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/31377
--
Edit this bug report at http://bugs.php.net/?id=31377&edit=1