Make WordPress Core

Ticket #42609: 42609.1.patch

File 42609.1.patch, 822 bytes (added by Otto42, 7 years ago)

Immediate fix, but not the best solution

  • wp-admin/includes/file.php

     
    385385                        return new WP_Error( 'invalid_plugin' );
    386386                }
    387387
    388                 if ( 0 !== validate_file( $file, get_plugin_files( $plugin ) ) ) {
     388                if ( ! in_array( validate_file( $file, get_plugin_files( $plugin ) ), array( 0, 2 ) ) ) {
    389389                        return new WP_Error( 'bad_plugin_file_path', __( 'Sorry, that file cannot be edited.' ) );
    390390                }
    391391
     
    445445                        }
    446446                }
    447447
    448                 if ( 0 !== validate_file( $real_file, $allowed_files ) ) {
     448                if ( ! in_array( validate_file( $real_file, $allowed_files ), array( 0, 2 ) ) ) {
    449449                        return new WP_Error( 'disallowed_theme_file', __( 'Sorry, that file cannot be edited.' ) );
    450450                }
    451451