Skip to content

XML-RPC: wp_editTerm, check 4th arg is an array#12628

Open
josephscott wants to merge 5 commits into
WordPress:trunkfrom
josephscott:65682/xml-rpc-wp-editterm-args
Open

XML-RPC: wp_editTerm, check 4th arg is an array#12628
josephscott wants to merge 5 commits into
WordPress:trunkfrom
josephscott:65682/xml-rpc-wp-editterm-args

Conversation

@josephscott

Copy link
Copy Markdown
Contributor

https://core.trac.wordpress.org/ticket/65682

AI assistance: Yes
Tool(s): Claude
Model(s): Opus 4.8
Used for: Writing the unit tests


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.

Copilot AI review requested due to automatic review settings July 21, 2026 19:13
@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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props josephscott.

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

Copilot AI left a comment

Copy link
Copy Markdown

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 hardens the wp.editTerm XML-RPC method against invalid/missing “content struct” input to prevent PHP 8+ fatals, and adds PHPUnit coverage for the new behavior.

Changes:

  • Make $content_struct retrieval tolerant of a missing index to avoid notices/fatals.
  • Add a type check so a non-array content struct is rejected with an IXR_Error instead of triggering a PHP 8+ fatal.
  • Add unit tests covering non-array and missing content struct scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/wp-includes/class-wp-xmlrpc-server.php Adds defensive handling for $args[4] and validates the content struct type before reading taxonomy data.
tests/phpunit/tests/xmlrpc/wp/editTerm.php Adds regression tests ensuring invalid/missing content struct inputs return XML-RPC errors instead of fatals.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/wp-includes/class-wp-xmlrpc-server.php
Copilot AI review requested due to automatic review settings July 21, 2026 19:16

Copilot AI left a comment

Copy link
Copy Markdown

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 no new comments.

Comments suppressed due to low confidence (1)

src/wp-includes/class-wp-xmlrpc-server.php:2219

  • $content_struct['taxonomy'] is accessed without verifying the key exists. If the client passes an empty/partial struct (e.g. array()), this will trigger an "Undefined array key 'taxonomy'" notice on PHP 8+ even though the method ultimately returns Invalid taxonomy.. Consider guarding the key (and short-circuiting) to avoid emitting notices for malformed requests.
		if (
			! is_array( $content_struct )
			|| empty( $content_struct['taxonomy'] )
			|| ! taxonomy_exists( $content_struct['taxonomy'] )

Copilot AI review requested due to automatic review settings July 21, 2026 19:18

Copilot AI left a comment

Copy link
Copy Markdown

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.

Comment thread src/wp-includes/class-wp-xmlrpc-server.php Outdated
Comment thread tests/phpunit/tests/xmlrpc/wp/editTerm.php
@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 21, 2026 19:22

Copilot AI left a comment

Copy link
Copy Markdown

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 no new comments.

Copilot AI review requested due to automatic review settings July 21, 2026 19:25

Copilot AI left a comment

Copy link
Copy Markdown

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 no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants