Make WordPress Core

Opened 5 hours ago

Last modified 5 hours ago

#66418 new defect (bug)

XML-RPC: is_a() with a string is deprecated in PHP 8.6

Reported by: dhrupo Owned by:
Priority: normal Milestone: Awaiting Review
Component: XML-RPC Version: trunk
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

PHP 8.6 deprecates calling is_a() with a string as the first argument when $allow_string is false.

IXR_Server passes the result of a method call to is_a( $result, 'IXR_Error' ), and that result is often a string. On PHP 8.6 a system.multicall request with any string result raises:

Deprecated: Calling is_a() with a string when $allow_string is false

The four multicall tests in Tests_XMLRPC_Basic fail on PHP 8.6.0-dev for this reason (test_multicall_with_non_array_params, test_multicall_with_missing_params, test_multicall_with_non_struct_entry, test_multicall_with_missing_method_name). They pass on PHP 8.5.

The same check is in IXR_Server::serve(), and IXR_IntrospectionServer::call() does it for date arguments. The two calls in IXR_Value are already guarded by is_object().

Using instanceof gives the same result without the deprecation.

Change History (2)

This ticket was mentioned in ​PR #15203 on ​WordPress/wordpress-develop by ​@dhrupo.


5 hours ago
#1

  • Keywords has-patch added

PHP 8.6 deprecates calling is_a() with a string when $allow_string is false. IXR_Server checks method results, which are often strings, with is_a( $result, 'IXR_Error' ), and IXR_IntrospectionServer does the same for date arguments. This uses instanceof, which gives the same result without the deprecation.

Testing

  • trunk, PHP 8.6.0-dev: --group xmlrpc has 4 errors (the Tests_XMLRPC_Basic::test_multicall_* tests, "Calling is_a() with a string when $allow_string is false").
  • this branch: OK (368 tests, 1383 assertions) on PHP 7.4.33, 8.5.12 and 8.6.0-dev.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Finding the issue by running the test suite on PHP 8.6, writing the change and running the checks above. I reviewed the change and checked the results myself.

#2 @dhrupo
5 hours ago

PR: ​https://github.com/WordPress/wordpress-develop/pull/15203

The four multicall tests fail on PHP 8.6.0-dev on trunk; with the PR, --group xmlrpc passes on PHP 7.4, 8.5 and 8.6 (368 tests).

Use of AI tools: I used Claude Code (Claude Opus 5.5) to find this by running the test suite on PHP 8.6 and to write the change. I reviewed it and checked the results myself.

Note: See TracTickets for help on using tickets.