Make WordPress Core

Changeset 55226


Ignore:
Timestamp:
02/06/2023 04:19:37 AM (2 years ago)
Author:
peterwilsoncc
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/file.php

    r55223 r55226  
    19801980        } elseif ( ! $wp_filesystem->delete( $to, true ) ) {
    19811981            // Can't overwrite if the destination couldn't be deleted.
    1982             return WP_Error( 'destination_not_deleted_move_dir', __( 'The destination directory already exists and could not be removed.' ) );
     1982            return new WP_Error( 'destination_not_deleted_move_dir', __( 'The destination directory already exists and could not be removed.' ) );
    19831983        }
    19841984    }
Note: See TracChangeset for help on using the changeset viewer.