Index: branches/5.2.x/core/units/helpers/file_helper.php =================================================================== diff -u -N -r15173 -r15533 --- branches/5.2.x/core/units/helpers/file_helper.php (.../file_helper.php) (revision 15173) +++ branches/5.2.x/core/units/helpers/file_helper.php (.../file_helper.php) (revision 15533) @@ -1,6 +1,6 @@ CheckFolder($path); - do { + while (file_exists($path . '/' . $new_name) || in_array($path . '/' . $new_name, $forbidden_names)) { if ( preg_match('/(.*)_([0-9]*)(' . preg_quote($ext, '/') . ')/', $new_name, $regs) ) { $new_name = $regs[1] . '_' . ((int)$regs[2] + 1) . $regs[3]; } @@ -450,8 +450,7 @@ } $original_checked = true; - $res = file_exists($path . '/' . $new_name) || in_array($path . '/' . $new_name, $forbidden_names); - } while ($res !== false); + } if ( $parts['dirname'] != '.' ) { $new_name = $parts['dirname'] . '/' . $new_name;