closedir() now really close the directory - used to stay open 'cause the
default-directory resource was "remembered" for arg-less calls.
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;
}
FETCH_DIRP();
zend_list_delete(dirp->id);
+
+ if (dirp->id == DIRG(default_dir)) {
+ php_set_default_dir(-1);
+ }
}
/* }}} */