php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11214 Strange functionality of opendir/closedir functions?
Submitted: 2001-05-31 09:58 UTC Modified: 2002-07-29 09:16 UTC
From: rac at whitestein dot com Assigned:
Status: Closed Package: Directory function related
PHP Version: 4.3.0-dev OS: WIN NT4.0
Private report: No CVE-ID: None
 [2001-05-31 09:58 UTC] rac at whitestein dot com
$dh = opendir( "xxx" );
while( ($file = readdir( $dh )) !== false )
{
  // code
}
closedir( $dh );
rmdir( "xxx" );

---------------
Produces permission denied on WIN NT4.0. Sorry, I did not have time to check it out in new release of PHP (I'm using 4.0.3pl1) or under LINUX.
The workaround I foud out to be working was this (looks like a problem of internal management of handles???):
---------------

$dh = opendir( "xxx" );
while( ($file = readdir( $dh )) !== false )
{
  // code
}
closedir( $dh );
unset( $dh );
rmdir( "xxx" );

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-31 10:00 UTC] rac at whitestein dot com
$dh = opendir( "xxx" );
while( ($file = readdir( $dh )) !== false )
{
  // code
}
closedir( $dh );
rmdir( "xxx" );

---------------
Produces permission denied on WIN NT4.0. The command which actually ends up with permission denied is the rmdir() which should delete the directory.
Sorry, I did not have time to check it out in new release of PHP (I'm using 4.0.3pl1) or under LINUX.
The workaround I foud out to be working was this (looks like a problem of internal management of handles???):
---------------

$dh = opendir( "xxx" );
while( ($file = readdir( $dh )) !== false )
{
  // code
}
closedir( $dh );
unset( $dh );
rmdir( "xxx" );


 [2001-05-31 10:01 UTC] rac at whitestein dot com
$dh = opendir( "xxx" );
while( ($file = readdir( $dh )) !== false )
{
  // code
}
closedir( $dh );
rmdir( "xxx" );

---------------
Produces permission denied on WIN NT4.0. The command which actually ends up with permission denied is the rmdir() which should delete the directory.
Sorry, I did not have time to check it out in new release of PHP (I'm using 4.0.3pl1) or under LINUX.
The workaround I foud out to be working was this (looks like a problem of internal management of handles???):
---------------

$dh = opendir( "xxx" );
while( ($file = readdir( $dh )) !== false )
{
  // code
}
closedir( $dh );
unset( $dh );
rmdir( "xxx" );


 [2002-07-03 06:39 UTC] sfox@php.net
This appears to be a rewinddir() problem afflicting ntfs only (still current in 4.3.0 dev).  Looking into it.
 [2002-07-29 09:16 UTC] sfox@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Nov 29 02:01:23 2020 UTC