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/plugin.php

    r38074 r38167  
    783783        $checked[] = 'checked[]=' . $plugin;
    784784
     785    $url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-plugins');
     786
    785787    ob_start();
    786     $url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-plugins');
    787     if ( false === ($credentials = request_filesystem_credentials($url)) ) {
    788         $data = ob_get_clean();
    789 
     788    $credentials = request_filesystem_credentials( $url );
     789    $data = ob_get_clean();
     790
     791    if ( false === $credentials ) {
    790792        if ( ! empty($data) ){
    791793            include_once( ABSPATH . 'wp-admin/admin-header.php');
     
    797799    }
    798800
    799     if ( ! WP_Filesystem($credentials) ) {
    800         request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
     801    if ( ! WP_Filesystem( $credentials ) ) {
     802        ob_start();
     803        request_filesystem_credentials( $url, '', true ); // Failed to connect, Error and request again.
    801804        $data = ob_get_clean();
    802805
Note: See TracChangeset for help on using the changeset viewer.