PHP 4.0 Bug #8519: closedir() does not close directory handle until script terminates

From: Date: Tue, 02 Jan 2001 18:28:43 +0000
Subject: PHP 4.0 Bug #8519: closedir() does not close directory handle until script terminates
Groups: php.dev 
Request: Send a blank email to php-dev+get-42600@lists.php.net to get a copy of this message
From: kat@unleashed.org Operating system: Windows NT 4.0, Windows 2000 Server PHP version: 4.0.3pl1 PHP Bug Type: Directory function related Bug description: closedir() does not close directory handle until script terminates The below script will generate a "permission denied" error when trying to rmdir the specified directory. sleep() does not do any good (in helping me delete the dir), nor does putting the reading of the directory into a function. After I moved the rmdir into a separate script it did not generate an error. It makes no difference whether it's forward or backward slashes in the path. This happens only after using the opendir/readdir/closedir sequence. I have not tested further to see if readdir may be the issue. This is a stock 4.03pl1 php, running as an apache module. My Test script: ------------------------- <?php $dirName = "c:/temp/foo.bar"; function checkDir() { global $dirName; $dirHandle = opendir($dirName); while($fileName = readdir($dirHandle)) { print $fileName."\n"; } closedir($dirHandle); } print "Making directory\n"; mkdir($dirName, 0777); checkDir(); print "Removing directory\n"; rmdir($dirName); ?> -------------------------------------------- -- Edit Bug report at: http://bugs.php.net/?id=8519&edit=1

« previous php.dev (#42600) next »