diff --git a/wp-includes/load.php b/wp-includes/load.php index 26fef7240a..e959d79db8 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -307,12 +307,13 @@ function timer_stop( $display = 0, $precision = 3 ) { * from changing the global configuration setting. Defining `WP_DEBUG_DISPLAY` * as false will force errors to be hidden. * - * When `WP_DEBUG_LOG` is true, errors will be logged to debug.log in the content - * directory. + * When `WP_DEBUG_LOG` is true, errors will be logged to `wp-content/debug.log`. + * When `WP_DEBUG_LOG` is a valid path, errors will be logged to the specified file. * * Errors are never displayed for XML-RPC, REST, and Ajax requests. * * @since 3.0.0 + * @since 5.1.0 `WP_DEBUG_LOG` can be a file path. * @access private */ function wp_debug_mode() { @@ -341,9 +342,17 @@ function wp_debug_mode() { ini_set( 'display_errors', 0 ); } - if ( WP_DEBUG_LOG ) { + if ( in_array( strtolower( (string) WP_DEBUG_LOG ), array( 'true', '1' ), true ) ) { + $log_path = WP_CONTENT_DIR . '/debug.log'; + } elseif ( is_string( WP_DEBUG_LOG ) ) { + $log_path = WP_DEBUG_LOG; + } else { + $log_path = false; + } + + if ( $log_path ) { ini_set( 'log_errors', 1 ); - ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' ); + ini_set( 'error_log', $log_path ); } } else { 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 ); diff --git a/wp-includes/version.php b/wp-includes/version.php index a8c7fba5e8..fc1ba44dd4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-alpha-44452'; +$wp_version = '5.1-alpha-44453'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.