You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function get_files_for_unique_filename_file_list() returns a boolean (false) if the parameter passed to scandir() is not a directory. This causes the filter where it is used to crash. If scandir() returns false the function should return an empty array.
Function
/**
* Override the files used for wp_unique_filename() comparisons
*
* @param array|null $files
* @param string $dir
* @return array
*/
public function get_files_for_unique_filename_file_list( ?array $files, string $dir, string $filename ) : array {
$name = pathinfo( $filename, PATHINFO_FILENAME );
// The s3:// streamwrapper support listing by partial prefixes with wildcards.
// For example, scandir( s3://bucket/2019/06/my-image* )
return scandir( trailingslashit( $dir ) . $name . '*' );
}
Error trace
Fatal error: Uncaught Error: Return value of S3_Uploads\Plugin::get_files_for_unique_filename_file_list() must be of the type array, bool returned in /srv/htdocs/wp-content/plugins/s3-uploads/inc/class-plugin.php on line 668
The function
get_files_for_unique_filename_file_list()
returns a boolean (false
) if the parameter passed toscandir()
is not a directory. This causes the filter where it is used to crash. Ifscandir()
returns false the function should return an empty array.Function
Error trace
The text was updated successfully, but these errors were encountered: