From: rr at d2g dot org dot uk Operating system: win XP PHP version: 5.1.5 PHP Bug Type: *Directory/Filesystem functions Bug description: Memory Leak when using pathinfo and DirectoryIterator __toString
Description: ------------ When running the code below on PHP version 5.1.6. On what seems to be any directory with files in, have tested with my C:/ and C:/folder/. The code below is run from the Command Line to recreate the issue. This is only present when using __toString rather than ->getFileName() or ->getPathName functions of DirectoryIterator. A memory leak occours. Reproduce code: --------------- <?php set_time_limit(0); while(true) { $CurrentDir = new DirectoryIterator("C:/"); foreach($CurrentDir as $file) { $tmp = pathinfo($file); print_r($tmp); } unset($tmp); unset($file); unset($CurrentDir); sleep(1); } ?> Expected result: ---------------- Works. Actual result: -------------- Works, but has memory Leak. -- Edit bug report at http://bugs.php.net/?id=38591&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38591&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38591&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38591&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38591&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38591&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38591&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38591&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38591&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38591&r=support Expected behavior: http://bugs.php.net/fix.php?id=38591&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38591&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38591&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38591&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38591&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38591&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38591&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38591&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38591&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38591&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38591&r=mysqlcfg