Make WordPress Core

Ticket #11090: 11090_3.patch

File 11090_3.patch, 4.8 KB (added by nacin, 17 years ago)

wp-settings.php will now set {{WP_DEBUG == false}}, making the {{defined(WP_DEBUG)}} check no longer needed in core or in plugins.

  • wp-includes/functions.php

     
    29332933 * to get the backtrace up to what file and function called the deprecated
    29342934 * function.
    29352935 *
    2936  * The current behavior is to trigger an user error if WP_DEBUG is defined and
     2936 * The current behavior is to trigger an user error if WP_DEBUG
    29372937 * is true.
    29382938 *
    29392939 * This function is to be used in every function in depreceated.php
     
    29552955        do_action('deprecated_function_run', $function, $replacement);
    29562956
    29572957        // Allow plugin to filter the output error trigger
    2958         if( defined('WP_DEBUG') && ( true === WP_DEBUG ) && apply_filters( 'deprecated_function_trigger_error', true )) {
     2958        if( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true )) {
    29592959                if( !is_null($replacement) )
    29602960                        trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
    29612961                else
     
    29702970 * to get the backtrace up to what file and function included the deprecated
    29712971 * file.
    29722972 *
    2973  * The current behavior is to trigger an user error if WP_DEBUG is defined and
     2973 * The current behavior is to trigger an user error if WP_DEBUG
    29742974 * is true.
    29752975 *
    29762976 * This function is to be used in every file that is depreceated
     
    29922992        do_action('deprecated_file_included', $file, $replacement);
    29932993
    29942994        // Allow plugin to filter the output error trigger
    2995         if( defined('WP_DEBUG') && ( true === WP_DEBUG ) && apply_filters( 'deprecated_file_trigger_error', true )) {
     2995        if( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
    29962996                if( !is_null($replacement) )
    29972997                        trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) );
    29982998                else
  • wp-includes/http.php

     
    655655
    656656                $proxy = new WP_HTTP_Proxy();
    657657
    658                 if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) ) {
     658                if ( !WP_DEBUG ) {
    659659                        if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
    660660                                $handle = @fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
    661661                        else
     
    826826                if ( 'http' != $arrURL['scheme'] && 'https' != $arrURL['scheme'] )
    827827                        $url = str_replace($arrURL['scheme'], 'http', $url);
    828828
    829                 if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) )
     829                if ( !WP_DEBUG )
    830830                        $handle = @fopen($url, 'r');
    831831                else
    832832                        $handle = fopen($url, 'r');
     
    999999
    10001000                $context = stream_context_create($arrContext);
    10011001
    1002                 if ( ! defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) )
     1002                if ( !WP_DEBUG )
    10031003                        $handle = @fopen($url, 'r', false, $context);
    10041004                else
    10051005                        $handle = fopen($url, 'r', false, $context);
     
    11671167                        }
    11681168                }
    11691169
    1170                 if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) ) //Emits warning level notices for max redirects and timeouts
     1170                if ( !WP_DEBUG ) //Emits warning level notices for max redirects and timeouts
    11711171                        $strResponse = @http_request($r['method'], $url, $r['body'], $options, $info);
    11721172                else
    11731173                        $strResponse = http_request($r['method'], $url, $r['body'], $options, $info); //Emits warning level notices for max redirects and timeouts
     
    11841184                $theHeaders = WP_Http::processHeaders($theHeaders);
    11851185
    11861186                if ( ! empty( $theBody ) && isset( $theHeaders['headers']['transfer-encoding'] ) && 'chunked' == $theHeaders['headers']['transfer-encoding'] ) {
    1187                         if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) )
     1187                        if ( !WP_DEBUG )
    11881188                                $theBody = @http_chunked_decode($theBody);
    11891189                        else
    11901190                                $theBody = http_chunked_decode($theBody);
  • wp-includes/wp-db.php

     
    357357        function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
    358358                register_shutdown_function(array(&$this, "__destruct"));
    359359
    360                 if ( defined('WP_DEBUG') and WP_DEBUG == true )
     360                if ( WP_DEBUG )
    361361                        $this->show_errors();
    362362
    363363                if ( defined('DB_CHARSET') )
  • wp-settings.php

     
    210210                ini_set('error_log', WP_CONTENT_DIR . '/debug.log');
    211211        }
    212212} else {
     213        define('WP_DEBUG', false);
    213214        if ( defined('E_RECOVERABLE_ERROR') )
    214215                error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
    215216        else