WordPress.org

Make WordPress Core

Ticket #18391: 18391.diff

File 18391.diff, 2.4 KB (added by nacin, 7 years ago)
  • wp-includes/default-constants.php

     
    4949        if ( !defined('WP_DEBUG') )
    5050                define( 'WP_DEBUG', false );
    5151
    52         // Add define('WP_DEBUG_DISPLAY', false); to wp-config.php use the globally configured setting for display_errors and not force errors to be displayed.
     52        // Add define('WP_DEBUG_DISPLAY', null); to wp-config.php use the globally configured setting for display_errors and not force errors to be displayed. Use false to force display_errors off.
    5353        if ( !defined('WP_DEBUG_DISPLAY') )
    5454                define( 'WP_DEBUG_DISPLAY', true );
    5555
  • wp-includes/load.php

     
    249249 * development environments.
    250250 *
    251251 * When WP_DEBUG_DISPLAY is true, WordPress will force errors to be displayed.
    252  * WP_DEBUG_DISPLAY defaults to true. Defining it as false prevents WordPress from
    253  * changing the global configuration setting. (Defining WP_DEBUG_DISPLAY as false
    254  * will never force errors to be hidden.)
     252 * WP_DEBUG_DISPLAY defaults to true. Defining it as null prevents WordPress from
     253 * changing the global configuration setting. Defining WP_DEBUG_DISPLAY as false
     254 * will force errors to be hidden.
    255255 *
    256  * When WP_DEBUG_LOG is true, errors will be logged to wp-content/debug.log.
     256 * When WP_DEBUG_LOG is true, errors will be logged to wp-content/debug.log. When
     257 * WP_DEBUG_LOG is a valid path, errors will be logged to the specified file.
    257258 * WP_DEBUG_LOG defaults to false.
    258259 *
    259260 * @access private
     
    270271
    271272                if ( WP_DEBUG_DISPLAY )
    272273                        ini_set( 'display_errors', 1 );
     274                elseif ( null !== WP_DEBUG_DISPLAY )
     275                        ini_set( 'display_errors', 0 );
    273276
    274277                if ( WP_DEBUG_LOG ) {
    275278                        ini_set( 'log_errors', 1 );
    276                         ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
     279                        if ( in_array( WP_DEBUG_LOG, array( true, 'true', 'TRUE', 1, '1' ), true ) || 0 !== validate_file( WP_DEBUG_LOG ) )
     280                                ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
     281                        else
     282                                ini_set( 'error_log', WP_DEBUG_LOG );
    277283                }
    278284        } else {
    279285                error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );