Skip to content

Repair wp/7.0 branch Actions: Guard setAccessible() calls for PHP 8.5 - #82811

Open
desrosj wants to merge 1 commit into
fix-actions-7.0/update-php-test-matrixfrom
fix-actions-7.0/guard-setaccessible-php85
Open

desrosj wants to merge 1 commit into
fix-actions-7.0/update-php-test-matrixfrom
fix-actions-7.0/guard-setaccessible-php85

Conversation

@desrosj

@desrosj desrosj commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Part of #82782.

What?

Guards every remaining unguarded ReflectionMethod::setAccessible()/ReflectionProperty::setAccessible() call in this branch's PHPUnit tests with if ( PHP_VERSION_ID < 80100 ), across 5 files and 23 call sites:

File Occurrences
phpunit/class-wp-theme-json-resolver-test.php 5
phpunit/blocks/class-wp-navigation-block-renderer-test.php 5
phpunit/class-wp-theme-json-test.php 8
phpunit/class-wp-duotone-test.php 4
phpunit/blocks/render-block-rss-test.php 1

Why?

PHP 8.5 deprecates ReflectionMethod::setAccessible()/ReflectionProperty::setAccessible() — they have had no effect since PHP 8.1, since reflection can already access private/protected members without the call from 8.1 onward. This branch's PHPUnit config turns deprecation notices into test errors, so the PHP 8.5 leg added by #82809, directly below, fails every test that makes one of these calls, with errors like:

Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1

The guard is required in both directions: PHP 8.5+ deprecates the call outright, but PHP < 8.1 (still supported — this branch's gutenberg.php requires PHP >= 7.4) genuinely cannot access private/protected members via reflection without it. if ( PHP_VERSION_ID < 80100 ) is the only way to satisfy both ends of the supported PHP range.

How?

Trunk hit and fixed the identical issue in commit 3fded09 (WordPress/gutenberg#79260, "CI: Run PHP unit tests on PHP 8.4 and 8.5"), landed 2026-06-17 — after wp/7.0 branched, so it never made it back to wp/7.0. This PR ports that same guard pattern to wp/7.0's own copies of these files, adapted to this branch's own line numbers/content (which have drifted somewhat from trunk's current state). Unlike trunk's diff, all 4 setAccessible() calls in class-wp-duotone-test.php needed the guard here (trunk's diff only shows 2, since the other 2 had already been guarded earlier in trunk's own history by a separate, unrelated commit that never landed on this branch).

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.

@desrosj desrosj added the [Type] Build Tooling Issues or PRs related to build tooling label Sep 11, 2026
@desrosj desrosj self-assigned this Sep 11, 2026
@desrosj
desrosj added this pull request to stack #82812 September 11, 2026 20:50
@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a457d70f-f550-4d70-90de-95b99fdd2fdd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

All affected calls use the correct PHP 8.1 boundary without changing test behavior on supported versions.

Pull request overview

Guards reflection accessibility calls for PHP 8.1+, preventing PHP 8.5 deprecation failures while retaining PHP 7.4–8.0 compatibility.

Changes:

  • Wraps all 23 setAccessible() calls with PHP version checks.
  • Preserves legacy reflection access behavior below PHP 8.1.
File summaries
File Description
phpunit/class-wp-theme-json-test.php Guards eight reflection calls.
phpunit/class-wp-theme-json-resolver-test.php Guards five reflection calls.
phpunit/class-wp-duotone-test.php Guards four reflection calls.
phpunit/blocks/render-block-rss-test.php Guards one reflection call.
phpunit/blocks/class-wp-navigation-block-renderer-test.php Guards five reflection calls.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@desrosj
desrosj force-pushed the fix-actions-7.0/guard-setaccessible-php85 branch from cebe1e2 to d14009f Compare September 14, 2026 01:51
@desrosj
desrosj force-pushed the fix-actions-7.0/guard-setaccessible-php85 branch from d14009f to ec8e601 Compare September 14, 2026 01:54
@desrosj
desrosj force-pushed the fix-actions-7.0/guard-setaccessible-php85 branch from ec8e601 to d6a1979 Compare September 14, 2026 01:56
@desrosj
desrosj force-pushed the fix-actions-7.0/guard-setaccessible-php85 branch from d6a1979 to 21910cc Compare September 14, 2026 02:39
@desrosj
desrosj force-pushed the fix-actions-7.0/guard-setaccessible-php85 branch from 21910cc to d24665f Compare September 14, 2026 16:43
@desrosj
desrosj force-pushed the fix-actions-7.0/guard-setaccessible-php85 branch from d24665f to 764f124 Compare September 14, 2026 17:02
@desrosj
desrosj force-pushed the fix-actions-7.0/guard-setaccessible-php85 branch from 764f124 to 83930ae Compare September 14, 2026 17:13
@desrosj
desrosj marked this pull request as ready for review September 14, 2026 17:15
@github-actions

github-actions Bot commented Sep 14, 2026 •

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>
Co-authored-by: ramonjd <ramonopoly@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 removed this pull request from stack #82812 September 22, 2026 16:29
@desrosj
desrosj changed the base branch from fix-actions-7.0/remove-disabled-mobile-unit-js to wp/7.0 September 22, 2026 16:29
@desrosj
desrosj force-pushed the fix-actions-7.0/guard-setaccessible-php85 branch from 83930ae to 3dab084 Compare September 22, 2026 16:33
@github-actions github-actions Bot added the [Tool] Env /packages/env label Sep 22, 2026
@desrosj
desrosj changed the base branch from wp/7.0 to fix-actions-7.0/update-php-test-matrix September 22, 2026 16:33
@github-actions github-actions Bot removed the [Tool] Env /packages/env label Oct 7, 2026
@desrosj
desrosj force-pushed the fix-actions-7.0/guard-setaccessible-php85 branch from 55f76b0 to df75cca Compare October 7, 2026 15:58
@desrosj
desrosj removed this pull request from stack #83630 October 7, 2026 18:13
@desrosj
desrosj changed the base branch from fix-actions-7.0/update-php-test-matrix to wp/7.0 October 7, 2026 18:14
@desrosj
desrosj force-pushed the fix-actions-7.0/guard-setaccessible-php85 branch from df75cca to 043db36 Compare October 7, 2026 18:16
@desrosj
desrosj changed the base branch from wp/7.0 to fix-actions-7.0/update-php-test-matrix October 7, 2026 18:17
@desrosj
desrosj added this pull request to stack #84187 October 7, 2026 18:18
@desrosj
desrosj removed this pull request from stack #84187 October 8, 2026 21:10
@desrosj
desrosj changed the base branch from fix-actions-7.0/update-php-test-matrix to wp/7.0 October 8, 2026 21:11
@desrosj
desrosj force-pushed the fix-actions-7.0/guard-setaccessible-php85 branch from 043db36 to a5c7388 Compare October 8, 2026 21:12
@github-actions github-actions Bot added the [Tool] Env /packages/env label Oct 8, 2026
@desrosj
desrosj changed the base branch from wp/7.0 to fix-actions-7.0/update-php-test-matrix October 8, 2026 21:13
@desrosj
desrosj added this pull request to stack #84347 October 8, 2026 21:13
@desrosj
desrosj removed this pull request from stack #84347 October 9, 2026 23:27
@desrosj
desrosj changed the base branch from fix-actions-7.0/update-php-test-matrix to wp/7.0 October 9, 2026 23:27
@desrosj
desrosj force-pushed the fix-actions-7.0/guard-setaccessible-php85 branch from a5c7388 to 7cd57aa Compare October 9, 2026 23:28
@desrosj
desrosj changed the base branch from wp/7.0 to fix-actions-7.0/update-php-test-matrix October 9, 2026 23:30
@desrosj
desrosj added this pull request to stack #84468 October 9, 2026 23:30
@desrosj desrosj changed the title Tests: Guard ReflectionMethod/Property::setAccessible() calls for PHP 8.5 (wp/7.0) Repair wp/7.0 branch Actions: Guard setAccessible() calls for PHP 8.5 Oct 16, 2026
@desrosj desrosj removed the [Tool] Env /packages/env label Oct 16, 2026
@desrosj
desrosj force-pushed the fix-actions-7.0/guard-setaccessible-php85 branch from 7cd57aa to d3a4e1e Compare October 19, 2026 17:04

@ramonjd ramonjd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Before (base PR, PHP 8.5) After (this PR)
#82811 wp/7.0 #82809: 65 errors, all setAccessible() is deprecated (1399 tests) All PHP jobs pass: 7.4, 8.0 and 8.5, single and multisite. PHP 8.5: 1399 tests, 0 errors

@desrosj
desrosj removed this pull request from stack #84468 October 21, 2026 18:35
@desrosj
desrosj added this pull request to stack #85325 October 21, 2026 18:35
@desrosj
desrosj force-pushed the fix-actions-7.0/guard-setaccessible-php85 branch from d3a4e1e to 9c38893 Compare October 23, 2026 17:27

This branch has not been deployed

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

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants