mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-03 20:24:26 +00:00
Media: when calling pathinfo(), also pass a PATHINFO_* constant to avoid array notices for unset keys.
Props JaworskiMatt. Fixes #37608. git-svn-id: https://develop.svn.wordpress.org/trunk@38294 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2034,13 +2034,16 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = null )
|
||||
$filename = sanitize_file_name($filename);
|
||||
|
||||
// Separate the filename into a name and extension.
|
||||
$info = pathinfo($filename);
|
||||
$ext = !empty($info['extension']) ? '.' . $info['extension'] : '';
|
||||
$name = basename($filename, $ext);
|
||||
$ext = pathinfo( $filename, PATHINFO_EXTENSION );
|
||||
$name = pathinfo( $filename, PATHINFO_BASENAME );
|
||||
if ( $ext ) {
|
||||
$ext = '.' . $ext;
|
||||
}
|
||||
|
||||
// Edge case: if file is named '.ext', treat as an empty name.
|
||||
if ( $name === $ext )
|
||||
if ( $name === $ext ) {
|
||||
$name = '';
|
||||
}
|
||||
|
||||
/*
|
||||
* Increment the file number until we have a unique file to save in $dir.
|
||||
|
||||
Reference in New Issue
Block a user