-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Site Health false positive: WP_DEBUG_LOG warning when debug.log is outside wp-content - Ticket #64071 #10684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Hi Team, Can you please help review and update the wordings if needed? Thank You, |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
…t false positives
westonruter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we wanted to go the extra mile, there could be a loopback request to try to actually request the file over HTTP to see if it returns anything. This may not be helpful in the end, however, as the file may not be present if nothing has been written to the log yet. Just an idea.
Thanks @westonruter, I thought of an edge case as well, what if there is no any log file present, then |
Good point. Well, in that case you could always check to see if wordpress-develop/src/wp-includes/load.php Lines 622 to 623 in 5a53b94
If, however, they do something like: define( 'WP_DEBUG_LOG`, ABSPATH . 'debug.log' );Then checking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a false positive in WordPress Site Health where a warning about WP_DEBUG_LOG being set to a potentially public file is shown even when the debug log is configured to be outside the wp-content directory (and thus not publicly accessible).
Changes:
- Modified the debug mode check to determine if error log files are within or outside the WordPress document root
- Added different status levels (critical vs good) and messages based on whether the log file is publicly accessible
- Differentiated messaging between WP_DEBUG_LOG constant usage and direct PHP error_log configuration
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…into fix/issue-64071
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** | ||
| * @var bool | ||
| */ | ||
| private $wp_debug; | ||
|
|
||
| /** | ||
| * @var bool|string | ||
| */ | ||
| private $wp_debug_log; | ||
|
|
||
| /** |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The property documentation lacks @SInCE tags and descriptive text. Consider adding fuller documentation: @since X.X.X and description like 'Whether WP_DEBUG is enabled.' for wp_debug, 'Value of WP_DEBUG_LOG constant (boolean or file path string).' for wp_debug_log, and 'Value of WP_DEBUG_DISPLAY constant or null if not defined.' for wp_debug_display.
| /** | |
| * @var bool | |
| */ | |
| private $wp_debug; | |
| /** | |
| * @var bool|string | |
| */ | |
| private $wp_debug_log; | |
| /** | |
| /** | |
| * Whether WP_DEBUG is enabled. | |
| * | |
| * @since 5.2.0 | |
| * @var bool | |
| */ | |
| private $wp_debug; | |
| /** | |
| * Value of WP_DEBUG_LOG constant (boolean or file path string). | |
| * | |
| * @since 5.2.0 | |
| * @var bool|string | |
| */ | |
| private $wp_debug_log; | |
| /** | |
| * Value of WP_DEBUG_DISPLAY constant or null if not defined. | |
| * | |
| * @since 5.2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @westonruter, Do we need to add @since tag here? So do I add @since 7.0.0, because we are adding the property to class, but ticket is on future release state, not sure if need to add it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 14 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $site_health = new WP_Site_Health(); | ||
| $reflection_mock = new ReflectionClass( $site_health ); |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable $site_health is created but its properties are never used. The reflection properties are set on $site_health_mock, but the ReflectionClass is instantiated from the unused $site_health instance. This appears to be a logic error - the reflection should be created from $site_health_mock instead, or the properties should be set on $site_health and then that instance should be used for the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment -- #10684 (comment)
| $site_health = new WP_Site_Health(); | ||
| $reflection_mock = new ReflectionClass( $site_health ); |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as in the production test: the variable $site_health is created but its properties are never used. The reflection properties are set on $site_health_mock, but the ReflectionClass is instantiated from the unused $site_health instance. This appears to be a logic error - the reflection should be created from $site_health_mock instead, or the properties should be set on $site_health and then that instance should be used for the test.
| $site_health = new WP_Site_Health(); | |
| $reflection_mock = new ReflectionClass( $site_health ); | |
| $reflection_mock = new ReflectionClass( $site_health_mock ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment -- #10684 (comment)
Trac ticket: https://core.trac.wordpress.org/ticket/64071
Screenshots
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.