Repository navigation
Repair wp/5.6 branch Actions: Handle a missing widget name when saving a widget in the widgets REST controller - #84978
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Size Change: 0 B Total Size: 1.2 MB ℹ️ View Unchanged
|
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
505ebcf to
44c099e
Compare
ntsekouras
left a comment
There was a problem hiding this comment.
LGTM, thanks! The three widget tests no longer fail on PHP 8.0, and all PHP jobs pass here.
44c099e to
7457886
Compare
Part of #82937.
What?
In
WP_REST_Widgets_Controller::save_widget(), passesnullas the widget name when the request has noname, instead of reading$input_widget['name']unconditionally.Why?
The request doesn't have to include
name. On PHP 8 the missing key is a warning, so threeREST_Widgets_Controller_Testtests (test_create_item,test_create_item_multiple_in_a_rowandtest_update_item_shouldnt_require_id_base) fail on thePHP 8.0jobs of #84977, directly below:These endpoints first shipped in WordPress 5.8. On this branch they exist only as plugin code in
lib/, which isn't in any npm package and never reaches a WordPress 5.6 release. A small change here keeps the tests green, so security fixes for the packages WordPress 5.6 does ship can be verified reliably.How?
The
isset()ternary passes the samenullPHP 7 already passed, so behavior is unchanged. It's used instead of??because this file also loads on PHP 5.6. Later versions of this controller were rewritten, so there's no upstream fix to port. This is the same change as #84794 onwp/5.7: this branch'slib/class-wp-rest-widgets-controller.phpis identical towp/5.7's before that PR.Use of AI Tools
This PR was created by Claude Code under my supervision. All code should be treated as AI-produced and not yet reviewed by a human until this PR is marked Ready for Review.
🤖 Generated with Claude Code