Repository navigation
Conversation
|
Hi @ilclaudio! 👋 Thank you for your contribution to WordPress! 💖 It looks like this is your first pull request to No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making. More information about how GitHub pull requests can be used to contribute to WordPress can be found in the Core Handbook. Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook. If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook. The Developer Hub also documents the various coding standards that are followed:
Thank you, |
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @claudiobat. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. Core Committers: Use this line as a base for the props when committing in SVN: At least one To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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. |
|
It looks like one of the GitHub Actions jobs failed due to a transient network issue (curl error 7 while downloading from packagist.org) and not because of my code changes. |
Re-run! |
|
@ilclaudio There's some feedback provided in this PR. |
|
Hi @juanmaguitar I have only proposed a patch but I'm not responsible to include it into the official code. I honestly don't know what else to do. |
|
@ilclaudio, first of all thank for proposing this patch for the ticket :) There's some feedback on the PR provided by @westonruter that still needs to be addressed
A response to that comment would be helpful to move forward with this PR |
84fe789 to
563e9f6
Compare
563e9f6 to
0a06f41
Compare
Sorry for the late reply, feedback addressed. |
Use debug_backtrace() to find and append the first plugin or theme file responsible for the incorrect usage to the error_log() message.
REST API: Guard against missing line in backtrace frame Co-authored-by: Weston Ruter <westonruter@gmail.com>
REST API: Address review feedback on doing_it_wrong logger Co-authored-by: Weston Ruter <westonruter@gmail.com>
|
Thanks for the feedback @westonruter. |
westonruter
left a comment
There was a problem hiding this comment.
🤖 Automated code review from Claude Code (high-effort recall pass), requested by @westonruter.
No crashing bugs found — the change is additive. Below are correctness edge cases and a couple of altitude/consistency concerns left as inline comments. These are suggestions from an automated reviewer; please use judgment.
westonruter
left a comment
There was a problem hiding this comment.
🤖 Claude Code — one more issue (raised by @westonruter): this logging does not honor error_reporting().
Derive the `Disallow` and `Allow` directives in `do_robots()` from `admin_url()` and `admin_url( 'admin-ajax.php' )` rather than from a hardcoded `/wp-admin/` path built off `site_url()`. Only the URL path portion is emitted, as before, so installs that relocate or filter their admin URL now produce a correct default `robots.txt`. Also guard the `Content-Type` header with a `headers_sent()` check to avoid a warning when the headers have already been sent. Developed in WordPress#11998. Follow-up to r34985. Props masteradhoc, yogeshbhutkar, hrohh, westonruter, mukeshpanchal27, 1ucay. Fixes #63467. git-svn-id: https://develop.svn.wordpress.org/trunk@62633 602fd350-edb4-49c9-b593-d223f7449a82
The `ini_get()` function is called unconditionally early in the bootstrap process, so there is no need for subsequent `function_exists( 'ini_get' )` checks. Follow-up to [44986], [45104]. Props siliconforks, shreyasikhar26, ankitkumarshah, westonruter, SergeyBiryukov. Fixes #65423. git-svn-id: https://develop.svn.wordpress.org/trunk@62634 602fd350-edb4-49c9-b593-d223f7449a82
This brings the `WP_Error` class to full PHPStan rule level 10 compliance. Also make use of null coalescing operator where appropriate, and simplify `has_errors()` method. Developed in WordPress#12405. Follow-up to r42761, r49115, r49116. See #64898, #64897. git-svn-id: https://develop.svn.wordpress.org/trunk@62635 602fd350-edb4-49c9-b593-d223f7449a82
…p()` and `::chown()`. This applies the equivalent fix which had previously been done to `::chmod()`. Tests are added for all three methods. Developed in subset of WordPress#11593. Follow-up to r12997. Fixes #65584. See #65409, WordPress#11261. git-svn-id: https://develop.svn.wordpress.org/trunk@62636 602fd350-edb4-49c9-b593-d223f7449a82
Change the optional constructor argument of `WP_Filesystem_FTPext`, `WP_Filesystem_ftpsockets`, and `WP_Filesystem_SSH2` from an empty string default to an empty `array`, matching how the argument is actually consumed, and improve the associated DocBlocks. These classes were also brought to adherence with PHPStan rule level 10: * Add `FileListing` and `Options` array shapes, and initialize each transport's `$options` to a complete default array before any early return. * Correct several inaccurate `@return` descriptions, including the `group()` methods that had been describing the owner. * Allow `WP_Filesystem_SSH2::connect()` to be retried after a failed connection attempt. * Stop `WP_Filesystem_FTPext::parselisting()` from leaking its intermediate date-parsing keys into the returned listing. * Add `ext-ftp` and `ext-ssh2` to the suggested extensions in `composer.json`. Developed in WordPress#11593. Follow-up to r62635, r62636. Props soean, westonruter, mukesh27. See #65584, #64898. Fixes #65409. git-svn-id: https://develop.svn.wordpress.org/trunk@62637 602fd350-edb4-49c9-b593-d223f7449a82
There was a problem hiding this comment.
Pull request overview
This PR updates WordPress REST API debug handlers so that _doing_it_wrong() (and related deprecation notices) are still written to debug.log during REST requests even when trigger_error() is suppressed to avoid interfering with REST responses.
Changes:
- Adds a REST-specific helper to extract a plugin/theme caller location from the backtrace for more actionable log entries.
- Adjusts REST debug handlers to avoid early-returning when headers are already sent, while still conditionally adding REST debug headers when possible.
- Logs REST deprecated/doing-it-wrong notices via
error_log()whenWP_DEBUG_LOGis enabled and the relevanterror_reporting()bit is set.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ok, fixed Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
…m/ilclaudio/wordpress-develop into fix/64260-rest-doing-it-wrong-log
Covers the caller reported for a named function, an instance method, a static method, a closure, and a call from a file's global scope; that the innermost frame inside WP_CONTENT_DIR is used; that calls from outside WP_CONTENT_DIR report nothing; and that a sibling directory sharing the content directory's name prefix, such as wp-content-backup, is not treated as part of it. Each test calls the function from a fixture file written inside WP_CONTENT_DIR, which is removed afterwards. See #64260.
|
I've added PHPUnit coverage for |
Tests: Add coverage for `_wp_rest_get_debug_backtrace_caller()`.
|
Thanks @rvpatel for the PHPUnit coverage of @westonruter, here's where the PR stands after the latest rounds of review:
The branch is up to date with trunk. Could you take another look when you have a moment? Your earlier "changes requested" review is still showing as blocking, so I'd appreciate a re-review (or dismissal if everything is addressed). |
Fixes #64260. The doing_it_wrong_trigger_error filter was preventing all doing_it_wrong notices from being logged during REST requests. This change ensures notices are written to debug.log while still preventing trigger_error() from interfering with REST responses.
Now the error is filterd but in the debug.log file you can see a meeesage like this:
[21-Nov-2025 14:01:41 UTC] REST API - Doing it wrong: register_rest_route - The REST API route definition for
test/v1/exampleis missing the requiredpermission_callbackargument. For REST API routes that are intended to be public, use__return_trueas the permission callback. (This message was added in version 5.5.0.)Trac ticket: https://core.trac.wordpress.org/ticket/64260