WordPress.org

Make WordPress Core

Ticket #18525: 18525.3.diff

File 18525.3.diff, 2.8 KB (added by kurtpayne, 7 years ago)

Re-reverted patch 11020, changed padding to html comments

  • wp-includes/functions.php

     
    32753275 * Flush all output buffers for PHP 5.2.
    32763276 *
    32773277 * Make sure all output buffers are flushed before our singletons our destroyed.
    3278  *
     3278 * Only use $disable_compression for pages that need to be updated continuously, like updating the core,
     3279 * or installing plugins, etc.
     3280 *
     3281 * Turn off compression - make sure to flush the buffer BEFORE
     3282 * turning off compression, see comment from Sam Yong
     3283 * @link http://php.net/manual/en/function.ob-end-clean.php
     3284 *
     3285 * Turn off mod_deflate
     3286 * @link http://httpd.apache.org/docs/2.2/env.html#no-gzip
     3287 *
     3288 * @param bool $disable_compression Turn off zlib / gzip compression, attempt to defeat chunking.
     3289 * @return void
    32793290 * @since 2.2.0
    32803291 */
    3281 function wp_ob_end_flush_all() {
    3282         $levels = ob_get_level();
    3283         for ($i=0; $i<$levels; $i++)
    3284                 ob_end_flush();
     3292function wp_ob_end_flush_all($disable_compression = false) {
     3293
     3294    // Clean the output buffer
     3295    $levels = ob_get_level();
     3296    for ($i=0; $i<$levels; $i++)
     3297        ob_end_flush();
     3298
     3299    if ( $disable_compression ) {
     3300        if ( !headers_sent() && ini_get('zlib.output_handler') ) {
     3301                ini_set('zlib.output_handler', '');
     3302                ini_set('zlib.output_compression', 0);
     3303        }
     3304
     3305        // Tell apache to send an uncompressed non-chunked response
     3306        if ( function_exists('apache_setenv') ) {
     3307                apache_setenv( 'no-gzip', '1' );
     3308        }
     3309
     3310        // Turn off any default output handlers
     3311        ini_set('output_handler', '');
     3312        ini_set('output_buffering', false);
     3313        ini_set('implicit_flush', true);
     3314
     3315        // Pad the output by a 4K block just to make sure that whatever
     3316        // apache/php considers a "chunk" is sent
     3317        // 8 chars x 512 repetitions = 4,096 chars
     3318        echo str_repeat('<!-- -->', 512);
     3319        flush();
     3320    }
    32853321}
    32863322
    32873323/**
  • wp-admin/includes/misc.php

     
    271271                        $message = $message->get_error_message();
    272272        }
    273273        echo "<p>$message</p>\n";
    274         wp_ob_end_flush_all();
    275         flush();
     274        wp_ob_end_flush_all(true);
    276275}
    277276
    278277function wp_doc_link_parse( $content ) {
  • wp-admin/includes/class-wp-upgrader.php

     
    12391239        }
    12401240
    12411241        function flush_output() {
    1242                 wp_ob_end_flush_all();
    1243                 flush();
     1242                wp_ob_end_flush_all(true);
    12441243        }
    12451244}
    12461245