Make WordPress Core

Changeset 54442


Ignore:
Timestamp:
10/10/2022 12:46:19 PM (21 months ago)
Author:
audrasjb
Message:

Upgrade/Install: Provide dirpath in error messages when _unzip_file_pclzip() cannot create directories.

This changeset ensures the directory path is provided in error messages when _unzip_file_pclzip() is unable to create a directory. This removes substr() which was returning an empty string in some use cases.

Props gunterer, SergeyBiryukov, n8finch, peterwilsoncc, audrasjb, rsiddharth, costdev , desrosj, mukesh27.
Fixes #54477.

File:
1 edited

Legend:

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

    r54140 r54442  
    17081708        // Only check to see if the Dir exists upon creation failure. Less I/O this way.
    17091709        if ( ! $wp_filesystem->mkdir( $_dir, FS_CHMOD_DIR ) && ! $wp_filesystem->is_dir( $_dir ) ) {
    1710             return new WP_Error( 'mkdir_failed_ziparchive', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) );
     1710            return new WP_Error( 'mkdir_failed_ziparchive', __( 'Could not create directory.' ), $_dir );
    17111711        }
    17121712    }
     
    18491849        // Only check to see if the dir exists upon creation failure. Less I/O this way.
    18501850        if ( ! $wp_filesystem->mkdir( $_dir, FS_CHMOD_DIR ) && ! $wp_filesystem->is_dir( $_dir ) ) {
    1851             return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) );
     1851            return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), $_dir );
    18521852        }
    18531853    }
Note: See TracChangeset for help on using the changeset viewer.