PHP 4.0 Bug #7573: closedir keeps directory open

From: Date: Wed, 01 Nov 2000 19:56:56 +0000
Subject: PHP 4.0 Bug #7573: closedir keeps directory open
Groups: php.dev 
Request: Send a blank email to php-dev+get-36710@lists.php.net to get a copy of this message
From: jase@sensis.com Operating system: Linux 2.2.17 PHP version: 4.0.3pl1 PHP Bug Type: Directory function related Bug description: closedir keeps directory open I have some code that mounts a remote file system, gets a directory listing, and then unmounts the file system. After upgraded to php 4.0.3pl1 from php3, the code did not work. Specifically, I could not unmount the file system. After looking into this, I discovered that even though I called closedir, the directory was still in use, and therefore could not be unmounted. This little code segment below shows the problem: <? $dh = opendir("."); closedir($dh); sleep(30); ?> During the sleep, which is after the closedir, I did a lsof, and found the following: apache 444 root 5r DIR 3,65 1024 47110 /usr/local/www-data/normal/htdocs To get around this, I put the code which opens, reads, and closes the directory into it's own function. It appears that when the function completes, the directory is really closed, and I can unmount the file system. Let me know if you need any more info. -- Edit Bug report at: http://bugs.php.net/?id=7573&edit=1

« previous php.dev (#36710) next »