Skip to content
Open
Changes from 4 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f99e009
CoreTrac-64071 Show different warning if debug.log is publicly access…
hbhalodia Jan 6, 2026
bcebdf8
CoreTrac-64071 Update the wordings and code structure
hbhalodia Jan 6, 2026
3749fef
CoreTrac-64071 Add the directory separator to absolute path to preven…
hbhalodia Jan 8, 2026
8636002
CoreTrac-64071 Update wordings in message to show in site-health for …
hbhalodia Jan 8, 2026
ffda9d8
CoreTrac-64071 Check the directory of log instead of checking file
hbhalodia Jan 9, 2026
b98ece6
CoreTrac-64071 Fix phpcs error
hbhalodia Jan 9, 2026
2da8e22
CoreTrac-64071 Update the debug_log_path to use error_log config
hbhalodia Jan 9, 2026
97e37bd
Merge branch 'trunk' into fix/issue-64071
hbhalodia Jan 9, 2026
ad94980
CoreTrac-64071 Fix grammetical mistake
hbhalodia Jan 12, 2026
551f125
CoreTrac-64071 Update message based on how log file is being set
hbhalodia Jan 12, 2026
825148f
Merge branch 'trunk' into fix/issue-64071
hbhalodia Jan 12, 2026
d2a8e12
CoreTrac-64071 Address copilot feedbacks
hbhalodia Jan 12, 2026
940f58a
CoreTrac-64071 Fix phpcs error
hbhalodia Jan 12, 2026
556a7ea
Fix placement of translators comments
westonruter Jan 12, 2026
c2704e9
Improve phpdoc return tag
westonruter Jan 12, 2026
205b76e
Use else case
westonruter Jan 12, 2026
8286a6c
Resolve copilot feedbacks related to ternary operator and messaging
hbhalodia Jan 13, 2026
4fee6cf
Merge branch 'trunk' into fix/issue-64071
hbhalodia Jan 13, 2026
fc6c9d9
Add private members for debug constant to work with tests
hbhalodia Jan 13, 2026
a1cc880
Remove extra variable storage space and use private member
hbhalodia Jan 13, 2026
21a27a6
Add the test cases for the function get_test_is_in_debug_mode
hbhalodia Jan 13, 2026
dac31ed
Update failing unit test cases
hbhalodia Jan 13, 2026
51a93ed
Optimise test case to use dry
hbhalodia Jan 13, 2026
afc7b60
Fix unit test failing with error
hbhalodia Jan 13, 2026
fde7a6c
Fix phpcs issue and update messaging in unit tests
hbhalodia Jan 13, 2026
0ae1b81
Update the wp_debug_display private value to be set
hbhalodia Jan 13, 2026
9b2d315
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter Jan 14, 2026
fe85708
Fix tests in PHP 8.5 where setAccessible is deprecated
westonruter Jan 14, 2026
aed8356
Address copilot feedbacks
hbhalodia Jan 15, 2026
6d644ab
Merge branch 'trunk' into fix/issue-64071
hbhalodia Jan 15, 2026
962ac3d
Resolve failed unit test and copilot feedbacks
hbhalodia Jan 15, 2026
636c1a1
Add @ticket annotation to tests
hbhalodia Jan 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions src/wp-admin/includes/class-wp-site-health.php
Original file line number Diff line number Diff line change
Expand Up @@ -1409,18 +1409,37 @@ public function get_test_is_in_debug_mode() {

if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
$result['label'] = __( 'Your site is set to log errors to a potentially public file' );
$debug_log_path = WP_DEBUG_LOG === true ? WP_CONTENT_DIR . '/debug.log' : WP_DEBUG_LOG;
$debug_log_path = realpath( $debug_log_path );
$absolute_path = realpath( ABSPATH ) . DIRECTORY_SEPARATOR;

$result['status'] = str_starts_with( ini_get( 'error_log' ), ABSPATH ) ? 'critical' : 'recommended';
if ( $debug_log_path && $absolute_path && str_starts_with( $debug_log_path, $absolute_path ) ) {
$result['label'] = __( 'Your site is set to log errors to a potentially public file' );

$result['description'] .= sprintf(
'<p>%s</p>',
sprintf(
/* translators: %s: WP_DEBUG_LOG */
__( 'The value, %s, has been added to this website&#8217;s configuration file. This means any errors on the site will be written to a file which is potentially available to all users.' ),
'<code>WP_DEBUG_LOG</code>'
)
);
$result['status'] = 'critical';

$result['description'] .= sprintf(
'<p>%s</p>',
sprintf(
/* translators: %s: WP_DEBUG_LOG */
__( 'The constant, %s, has been added to this website&#8217;s configuration file. This means any errors on the site will be written to a file which is likely publicly accessible.' ),
'<code>WP_DEBUG_LOG</code>'
)
);
} else {
$result['label'] = __( 'Your site is set to log errors to a file outside the document root' );

$result['status'] = 'good';

$result['description'] .= sprintf(
'<p>%s</p>',
sprintf(
/* translators: %s: WP_DEBUG_LOG */
__( 'The configuration constant, %s, has been set to write errors to a file outside the WordPress directory. This is a good practice as the log file should not be publicly accessible' ),
'<code>WP_DEBUG_LOG</code>'
)
);
}
}

if ( defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY ) {
Expand Down
Loading