Changeset 46966 for trunk/src/wp-includes/functions.php
- Timestamp:
- 12/16/2019 11:42:34 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r46965 r46966 2411 2411 // Sanitize the file name before we begin processing. 2412 2412 $filename = sanitize_file_name( $filename ); 2413 $ext2 = null; 2413 2414 2414 2415 // Separate the filename into a name and extension. … … 2486 2487 2487 2488 if ( ! empty( $files ) ) { 2488 while ( _wp_check_existing_file_names( $filename, $files ) ) { 2489 // The extension case may have changed above. 2490 $new_ext = ! empty( $ext2 ) ? $ext2 : $ext; 2491 2492 // Ensure this never goes into infinite loop 2493 // as it uses pathinfo() and regex in the check but string replacement for the changes. 2494 $count = count( $files ); 2495 $i = 1; 2496 2497 while ( $i <= $count && _wp_check_existing_file_names( $filename, $files ) ) { 2489 2498 $new_number = (int) $number + 1; 2490 $filename = str_replace( array( "-{$number}{$ ext}", "{$number}{$ext}" ), "-{$new_number}{$ext}", $filename );2499 $filename = str_replace( array( "-{$number}{$new_ext}", "{$number}{$new_ext}" ), "-{$new_number}{$new_ext}", $filename ); 2491 2500 $number = $new_number; 2501 $i++; 2492 2502 } 2493 2503 } … … 2531 2541 } 2532 2542 2533 $regex = '/^' . preg_quote( $fname ) . '-(?:\d+x\d+|scaled|rotated)' . preg_quote( $ext ) . '$/ ';2543 $regex = '/^' . preg_quote( $fname ) . '-(?:\d+x\d+|scaled|rotated)' . preg_quote( $ext ) . '$/i'; 2534 2544 2535 2545 foreach ( $files as $file ) {
Note: See TracChangeset
for help on using the changeset viewer.