Make WordPress Core


Ignore:
Timestamp:
07/27/2016 05:09:27 PM (8 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/ajax-actions.php

    r38159 r38167  
    35163516    }
    35173517
    3518     // Check filesystem credentials. `delete_plugins()` will bail otherwise.
     3518    // Check filesystem credentials. `delete_theme()` will bail otherwise.
     3519    $url = wp_nonce_url( 'themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet );
    35193520    ob_start();
    3520     $url = wp_nonce_url( 'themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet );
    3521     if ( false === ( $credentials = request_filesystem_credentials( $url ) ) || ! WP_Filesystem( $credentials ) ) {
     3521    $credentials = request_filesystem_credentials( $url );
     3522    ob_end_clean();
     3523    if ( false === $credentials || ! WP_Filesystem( $credentials ) ) {
    35223524        global $wp_filesystem;
    3523         ob_end_clean();
    35243525
    35253526        $status['errorCode']    = 'unable_to_connect_to_filesystem';
     
    37723773
    37733774    // Check filesystem credentials. `delete_plugins()` will bail otherwise.
     3775    $url = wp_nonce_url( 'plugins.php?action=delete-selected&verify-delete=1&checked[]=' . $plugin, 'bulk-plugins' );
    37743776    ob_start();
    3775     $url = wp_nonce_url( 'plugins.php?action=delete-selected&verify-delete=1&checked[]=' . $plugin, 'bulk-plugins' );
    3776     if ( false === ( $credentials = request_filesystem_credentials( $url ) ) || ! WP_Filesystem( $credentials ) ) {
     3777    $credentials = request_filesystem_credentials( $url );
     3778    ob_end_clean();
     3779    if ( false === $credentials || ! WP_Filesystem( $credentials ) ) {
    37773780        global $wp_filesystem;
    3778         ob_end_clean();
    37793781
    37803782        $status['errorCode']    = 'unable_to_connect_to_filesystem';
Note: See TracChangeset for help on using the changeset viewer.