Skip to content

[BUGFIX] ReflectionProperty::setAccessible() is deprecated since 8.5#79

Closed
achimfritz wants to merge 1 commit into
zumba:masterfrom
b13:bugfix/reflection-property
Closed

[BUGFIX] ReflectionProperty::setAccessible() is deprecated since 8.5#79
achimfritz wants to merge 1 commit into
zumba:masterfrom
b13:bugfix/reflection-property

Conversation

@achimfritz

Copy link
Copy Markdown

a PHP Runtime Deprecation Notice is triggered when calling ReflectionProperty::setAccessible() in PHP 8.5

the method has no effect since PHP 8.1

s. https://www.php.net/manual/en/reflectionproperty.setaccessible.php

a PHP Runtime Deprecation Notice is triggered when
calling ReflectionProperty::setAccessible() in PHP 8.5

the method has no effect since PHP 8.1

s. https://www.php.net/manual/en/reflectionproperty.setaccessible.php
try {
$propRef = $this->getReflectionProperty($ref, $property);
$propRef->setAccessible(true);
if (version_compare(PHP_VERSION, '8.1.0') < 0) {

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.

You can directly use the PHP version constant and hard code an int instead of using a function call

@williamdes

Copy link
Copy Markdown
Contributor

Duplicate of #78

@achimfritz

Copy link
Copy Markdown
Author

ah, thanks, did not see the #78 issue

would be cool to merge and release this (so i can drop my composer-patch in my project), thanks

@achimfritz achimfritz closed this Jun 12, 2026
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