WordPress.org

Make WordPress Core

Ticket #51857: 51857.diff

File 51857.diff, 513 bytes (added by afragen, 3 months ago)

In copy_dir() check $wp_filesystem->dirlist() and return WP_Error if false

  • wp-admin/includes/file.php

    diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php
    index 993635e460..954863a480 100644
    a b function copy_dir( $from, $to, $skip_list = array() ) { 
    17431743
    17441744        $dirlist = $wp_filesystem->dirlist( $from );
    17451745
     1746        if ( ! $dirlist ) {
     1747                return new WP_Error( 'dirlist_failed_copy_dir', __( 'Directory listing failed.' ), $wp_filesystem->method );
     1748        }
     1749
    17461750        $from = trailingslashit( $from );
    17471751        $to   = trailingslashit( $to );
    17481752