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.
Built from https://develop.svn.wordpress.org/trunk@38167


git-svn-id: http://core.svn.wordpress.org/trunk@38108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling
2016-07-27 17:11:56 +00:00
parent 9ee1823d91
commit e4abc1ecbf
4 changed files with 29 additions and 20 deletions

View File

@@ -782,11 +782,13 @@ function delete_plugins( $plugins, $deprecated = '' ) {
foreach ( $plugins as $plugin )
$checked[] = 'checked[]=' . $plugin;
ob_start();
$url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-plugins');
if ( false === ($credentials = request_filesystem_credentials($url)) ) {
$data = ob_get_clean();
ob_start();
$credentials = request_filesystem_credentials( $url );
$data = ob_get_clean();
if ( false === $credentials ) {
if ( ! empty($data) ){
include_once( ABSPATH . 'wp-admin/admin-header.php');
echo $data;
@@ -796,8 +798,9 @@ function delete_plugins( $plugins, $deprecated = '' ) {
return;
}
if ( ! WP_Filesystem($credentials) ) {
request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
if ( ! WP_Filesystem( $credentials ) ) {
ob_start();
request_filesystem_credentials( $url, '', true ); // Failed to connect, Error and request again.
$data = ob_get_clean();
if ( ! empty($data) ){