From 71815b682c0dd6fb5f367ba06eab722f379a0fcc Mon Sep 17 00:00:00 2001 From: nacin Date: Wed, 27 Oct 2010 22:27:06 +0000 Subject: [PATCH] Use call_user_func for wpnique_filename callback. fixes #14627. git-svn-id: http://svn.automattic.com/wordpress/trunk@16025 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 317fef139b..84545a7978 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2198,14 +2198,14 @@ function wp_upload_dir( $time = null ) { * before the extension, and will continue adding numbers until the filename is * unique. * - * The callback must accept two parameters, the first one is the directory and - * the second is the filename. The callback must be a function. + * The callback is passed three parameters, the first one is the directory, the + * second is the filename, and the third is the extension. * * @since 2.5 * * @param string $dir * @param string $filename - * @param string $unique_filename_callback Function name, must be a function. + * @param mixed $unique_filename_callback Callback. * @return string New filename, if given wasn't unique. */ function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) { @@ -2221,9 +2221,9 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) if ( $name === $ext ) $name = ''; - // Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback'] if supplied. + // Increment the file number until we have a unique file to save in $dir. Use callback if supplied. if ( $unique_filename_callback && is_callable( $unique_filename_callback ) ) { - $filename = $unique_filename_callback( $dir, $name ); + $filename = call_user_func( $unique_filename_callback, $dir, $name, $ext ); } else { $number = '';