WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/27/2016 05:09:27 PM (5 years ago)
Author:
ocean90
Message:

Filesystem API: Output buffering for request_filesystem_credentials() should wrap the function directly.

Previously ob_end_clean() was only called when the previous condition was successful which led to unexpected results when another output buffering was involved, like PHPUnit's.

Fixes #37488.

File:
1 edited

Legend:

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

    r38082 r38167  
    2424        return false;
    2525
     26    if ( empty( $redirect ) ) {
     27        $redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet);
     28    }
     29
    2630    ob_start();
    27     if ( empty( $redirect ) )
    28         $redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet);
    29     if ( false === ($credentials = request_filesystem_credentials($redirect)) ) {
    30         $data = ob_get_clean();
    31 
    32         if ( ! empty($data) ){
     31    $credentials = request_filesystem_credentials( $redirect );
     32    $data = ob_get_clean();
     33
     34    if ( false === $credentials ) {
     35        if ( ! empty( $data ) ){
    3336            include_once( ABSPATH . 'wp-admin/admin-header.php');
    3437            echo $data;
     
    3942    }
    4043
    41     if ( ! WP_Filesystem($credentials) ) {
    42         request_filesystem_credentials($redirect, '', true); // Failed to connect, Error and request again
     44    if ( ! WP_Filesystem( $credentials ) ) {
     45        ob_start();
     46        request_filesystem_credentials( $redirect, '', true ); // Failed to connect, Error and request again.
    4347        $data = ob_get_clean();
    4448
Note: See TracChangeset for help on using the changeset viewer.