From be3d8fdcc3e9009d7aee233e00e529e11ae6baed Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Mon, 6 Feb 2023 04:21:20 +0000 Subject: [PATCH] Filesystem API: Prevent fatal error in `move_dir()`. Correctly instantiate `WP_Error()` within `move_dir()` to prevent a fatal error when unable to delete an existing directory that is intended to be replaced. Follow-up to [55204], [55219], [55220], [55223]. Props swissspidy, costdev, afragen. Fixes #57375. Built from https://develop.svn.wordpress.org/trunk@55226 git-svn-id: http://core.svn.wordpress.org/trunk@54759 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/file.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 44d1b8d080..cc0c0a8af2 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -1979,7 +1979,7 @@ function move_dir( $from, $to, $overwrite = false ) { return new WP_Error( 'destination_already_exists_move_dir', __( 'The destination folder already exists.' ), $to ); } elseif ( ! $wp_filesystem->delete( $to, true ) ) { // Can't overwrite if the destination couldn't be deleted. - return WP_Error( 'destination_not_deleted_move_dir', __( 'The destination directory already exists and could not be removed.' ) ); + return new WP_Error( 'destination_not_deleted_move_dir', __( 'The destination directory already exists and could not be removed.' ) ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index ee89257d07..7021617b1a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-55225'; +$wp_version = '6.2-alpha-55226'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.