Opened 16 years ago
Closed 16 years ago
#11749 closed defect (bug) (fixed)
recurse_dirsize() leaves directories open
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 3.0 | Priority: | normal |
| Severity: | normal | Version: | 3.0 |
| Component: | Multisite | Keywords: | has-patch |
| Focuses: | Cc: |
Description
shouldn't we close the dir handle before returning false?
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
Nice question. I just wondered as well and since the PHP documnetation does offer both possiblities - automatically close with the garbage collector which can be a benefit for a functions local variables ( :) ) or not for some types (persistent database connections e.g.) I thought it's a good Idea to do some tests.
Stream Details
Testing Log
Warning: readdir(): no Directory resource supplied in __FILE__ on line __LINE__).Warning: closedir(): __RESOURCENUMBER__ is not a valid Directory resource in __FILE__ on line __LINE__).Suggestion
Since directory handles do not look like somehow limited there is no fear to run out of those. Since closing does actually does only produce overhead and not any benefit, it can be suggested to not close directory handles even if this sounds wired.
Testbed
PHP PHP Version 5.2.8; Windows NT 5.1 build 2600; Server API CGI/FastCGI. Used xdebug 2.0.0RC4-dev to gather memory and execution time.