From: Thies C. Arntzen Date: Sat, 4 Nov 2000 14:58:50 +0000 (+0000) Subject: fix #7573 X-Git-Tag: php-4.0.4RC3~323 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b80e71fdac69a14726b2b7dead16cfef086d06f1;p=php fix #7573 closedir() now really close the directory - used to stay open 'cause the default-directory resource was "remembered" for arg-less calls. --- diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 0ad886cb4f..5ac26e721b 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -102,8 +102,12 @@ static void php_set_default_dir(int id DIRLS_DC) if (DIRG(default_dir)!=-1) { zend_list_delete(DIRG(default_dir)); } - DIRG(default_dir) = id; - zend_list_addref(id); + + if (id != -1) { + zend_list_addref(id); + } + + DIRG(default_dir) = id; } @@ -211,6 +215,10 @@ PHP_FUNCTION(closedir) FETCH_DIRP(); zend_list_delete(dirp->id); + + if (dirp->id == DIRG(default_dir)) { + php_set_default_dir(-1); + } } /* }}} */