Skip to content

PHP 8.5 compatibility: Method ReflectionProperty::setAccessible is deprecated#206

Open
vovayatsyuk wants to merge 1 commit into
OpenForgeProject:mainfrom
vovayatsyuk:fix/php-8.5
Open

PHP 8.5 compatibility: Method ReflectionProperty::setAccessible is deprecated#206
vovayatsyuk wants to merge 1 commit into
OpenForgeProject:mainfrom
vovayatsyuk:fix/php-8.5

Conversation

@vovayatsyuk

@vovayatsyuk vovayatsyuk commented Jun 26, 2026

Copy link
Copy Markdown

When trying to use theme inspector with Magento 2.4.9 and PHP 8.5 I've got en exception:

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

Since this project doesn't support PHP 8.0, this is not a BC.

View Screenshot image

Copilot AI review requested due to automatic review settings June 26, 2026 07:02
@github-actions github-actions Bot added the Fix label Jun 26, 2026

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.

Pull request overview

Removes use of the deprecated ReflectionProperty::setAccessible() in the theme inspector’s block cache collection logic to restore PHP 8.5 compatibility (Magento 2.4.9), without introducing a backwards-compatibility concern for this project’s supported PHP versions.

Changes:

  • Removed the ReflectionProperty::setAccessible(true) call when reading _isScopePrivate via reflection.
  • Continued to use ReflectionProperty::getValue() inside the existing try/catch fallback path for private-block detection.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants