Skip to content

Repair wp/5.7 branch Actions: Only read the template slug when a template exists in the templates REST controller - #716

Closed
desrosj wants to merge 1 commit into
fix-actions-5.7/fix-widgets-controller-missing-namefrom
fix-actions-5.7/fix-templates-controller-null-template
Closed

desrosj wants to merge 1 commit into
fix-actions-5.7/fix-widgets-controller-missing-namefrom
fix-actions-5.7/fix-templates-controller-null-template

Conversation

@desrosj

@desrosj desrosj commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

What?

In WP_REST_Templates_Controller::prepare_item_for_database(), moves $changes->post_name = $template->slug into the two branches where $template exists.

Why?

When a template is created, $template is null, and the method reads $template->slug before checking for that. On PHP 8 this is a warning, so test_create_item fails on the PHP 8.0 jobs:

Attempt to read property "slug" on null

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.7 release. A small change here keeps the tests green, so security fixes for the packages WordPress 5.7 does ship can be verified reliably.

How?

This is the same change as WordPress@046c82f (WordPress#32176), applied by hand because that commit doesn't cherry-pick here. Behavior is unchanged: updates still set post_name from the template, and create_item() already sets it from the request.

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

@desrosj desrosj self-assigned this Oct 9, 2026
@desrosj
desrosj added this pull request to stack #717 October 9, 2026 15:13
@desrosj
desrosj removed this pull request from stack #717 October 9, 2026 19:50
@desrosj
desrosj changed the base branch from fix-actions-5.7/fix-widgets-controller-missing-name to wp/5.7 October 9, 2026 19:51
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-templates-controller-null-template branch from ddc8b65 to f3baf87 Compare October 9, 2026 19:53
@desrosj
desrosj changed the base branch from wp/5.7 to fix-actions-5.7/fix-widgets-controller-missing-name October 9, 2026 19:55
@desrosj
desrosj added this pull request to stack #719 October 9, 2026 19:55
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-templates-controller-null-template branch from f3baf87 to edaaf0c Compare October 13, 2026 02:21
@desrosj
desrosj force-pushed the fix-actions-5.7/fix-templates-controller-null-template branch from edaaf0c to 680bd2b Compare October 13, 2026 02:41
@desrosj
desrosj marked this pull request as ready for review October 15, 2026 02:24
@github-actions

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: desrosj <desrosj@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@desrosj

desrosj commented Oct 15, 2026

Copy link
Copy Markdown
Owner Author

Moved to WordPress#84795.

@desrosj desrosj closed this Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant