Repository navigation
Formatting: Map ArrayObject entries in map_deep() - #14860
benitoalba wants to merge 2 commits into
Conversation
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. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
| * Object-backed storage is deprecated as of PHP 8.5. | ||
| * | ||
| * @ticket 53160 | ||
| * @requires PHP < 8.5 |
There was a problem hiding this comment.
Yes, I retested this with PHPUnit 9.6.38 on PHP 8.3.36 and 8.5.12, on both single site and multisite. All 22 tests pass on 8.3. On 8.5, only this fixture skips, with PHP < 8.5 is required.
Removing the annotation makes the fixture fail on PHP 8.5 because new ArrayObject( $storage ) triggers the object-backed storage deprecation.
On PHP 7.4+,
get_object_vars()excludesArrayObjectstorage.map_deep()therefore skips those entries, which also leaves slashes or URL characters unchanged when its wrappers receive anArrayObject.Walk the stored entries explicitly, then keep the existing public-property traversal.
STD_PROP_LISTstill selects property-only handling, and the original flags and object identity are preserved. Tests cover nested containers, object-backed storage, empty instances, and all four Core wrappers that callmap_deep().Trac ticket: https://core.trac.wordpress.org/ticket/53160
Testing
Tested with PHP 8.3.36 and PHP 8.5.12, using PHPUnit 9.6.38:
53160): 2,206 tests and 1,118,564 assertions.git diff --checkpass.The object-backed fixture runs only below PHP 8.5 because PHP 8.5 deprecated that constructor usage. All array-backed and public-property cases continue to run on PHP 8.5.
Use of AI Tools
AI assistance: Yes. OpenAI Codex researched the ticket, wrote the patch and tests, ran local validation, and drafted this description.
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.