From 6403619f92b18f0ebdeeb36a03f06899ca309c9b Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 17 Dec 2019 20:52:03 +0000 Subject: [PATCH] Upload: Run the final file name collision test in `wp_unique_filename()` for each existing file + 1. Props pbiron. See #48975. Built from https://develop.svn.wordpress.org/trunk@46976 git-svn-id: http://core.svn.wordpress.org/trunk@46776 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 6a7b16563d..7bb1c59632 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2492,7 +2492,7 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) // Ensure this never goes into infinite loop // as it uses pathinfo() and regex in the check but string replacement for the changes. $count = count( $files ); - $i = 1; + $i = 0; while ( $i <= $count && _wp_check_existing_file_names( $filename, $files ) ) { $new_number = (int) $number + 1; diff --git a/wp-includes/version.php b/wp-includes/version.php index aa81525396..670c40441f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-46974'; +$wp_version = '5.4-alpha-46976'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.