Skip to:
Content

bbPress.org

Ticket #3294: trac-3294-phpcs-fix-silenced-errors-2.patch

File trac-3294-phpcs-fix-silenced-errors-2.patch, 918 bytes (added by jrf, 5 years ago)

Fixes most violations against the WordPress.PHP.NoSilencedErrors.Discouraged error code - part 2

  • src/includes/common/ajax.php

     
    114114function bbp_ajax_headers() {
    115115
    116116        // Set the header content type
    117         @header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
    118         @header( 'X-Robots-Tag: noindex' );
     117        if ( ! headers_sent() ) {
     118                header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
     119                header( 'X-Robots-Tag: noindex' );
     120        }
    119121
    120122        // Disable content sniffing in browsers that support it
    121123        send_nosniff_header();
     
    153155        }
    154156
    155157        // Send back the JSON
    156         @header( 'Content-type: application/json' );
     158        if ( ! headers_sent() ) {
     159                header( 'Content-type: application/json' );
     160        }
    157161        echo json_encode( $response );
    158162        die();
    159163}