ID: 39379 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: *Directory/Filesystem functions Operating System: windows xp sp2 PHP Version: 5.2.0 New Comment:
Your function reads the directory and creates files in it in the same time. Previous Comments: ------------------------------------------------------------------------ [2006-11-04 16:20:18] [EMAIL PROTECTED] Description: ------------ When I use function rename() to rename a folder by recursion. But it doesn't work as usual.It renamed the file twice. Reproduce code: --------------- function addDomain($directory) { if (is_dir($directory)) { $dirHandle = opendir($directory); while ($file = readdir($dirHandle)) { if ($file != '.' && $file != '..') { if (is_dir($file)) { //do nothing; } else { rename($directory.$file,$directory.$file.'r'); echo $directory.$file.'<br>'; } } } closedir($dirHandle); } } addDomain("test/"); Expected result: ---------------- test/Q4.php<br>test/Q5.php<br> Actual result: -------------- test/Q4.php<br>test/Q5.php<br>test/Q4.phpr<br>test/Q5.phpr<br> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39379&edit=1