Make WordPress Core

Ticket #18391: 18391.3.diff

File 18391.3.diff, 1.4 KB (added by SergeyBiryukov, 7 years ago)
  • src/wp-includes/load.php

     
    307307 * from changing the global configuration setting. Defining `WP_DEBUG_DISPLAY`
    308308 * as false will force errors to be hidden.
    309309 *
    310  * When `WP_DEBUG_LOG` is true, errors will be logged to debug.log in the content
    311  * directory.
     310 * When `WP_DEBUG_LOG` is true, errors will be logged to `wp-content/debug.log`.
     311 * When `WP_DEBUG_LOG` is a valid path, errors will be logged to the specified file.
    312312 *
    313313 * Errors are never displayed for XML-RPC, REST, and Ajax requests.
    314314 *
    315315 * @since 3.0.0
     316 * @since 5.0.0 `WP_DEBUG_LOG` can be a file path.
    316317 * @access private
    317318 */
    318319function wp_debug_mode() {
     
    341342                        ini_set( 'display_errors', 0 );
    342343                }
    343344
    344                 if ( WP_DEBUG_LOG ) {
     345                if ( in_array( strtolower( (string) WP_DEBUG_LOG ), array( 'true', '1' ), true ) ) {
     346                        $log_path = WP_CONTENT_DIR . '/debug.log';
     347                } elseif ( is_string( WP_DEBUG_LOG ) ) {
     348                        $log_path = WP_DEBUG_LOG;
     349                } else {
     350                        $log_path = false;
     351                }
     352
     353                if ( $log_path ) {
    345354                        ini_set( 'log_errors', 1 );
    346                         ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
     355                        ini_set( 'error_log', $log_path );
    347356                }
    348357        } else {
    349358                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 );