Skip to content

fixed 'Method ReflectionProperty::setAccessible() is deprecated since 8.5'#45

Merged
terrafrost merged 4 commits intophpseclib:masterfrom
shimooka:master
Apr 8, 2026
Merged

fixed 'Method ReflectionProperty::setAccessible() is deprecated since 8.5'#45
terrafrost merged 4 commits intophpseclib:masterfrom
shimooka:master

Conversation

@shimooka
Copy link
Copy Markdown
Contributor

@shimooka shimooka commented Apr 2, 2026

I fixed deprecation warning with PHP8.5.4 and mcrypt_compat 2.0.7 .

Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 /app/xdata/src/xd_webapp/alpha/vendor/phpseclib/mcrypt_compat/lib/mcrypt.php(796)

Copy link
Copy Markdown
Member

@terrafrost terrafrost left a comment

Choose a reason for hiding this comment

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

Looks good! Just two small changes and we'll be good to go!

lib/mcrypt.php Outdated
$reflectionProperty = $reflectionObject->getProperty('key');
$reflectionProperty->setAccessible(true); // can be dropped in PHP 8.1.0+

if (version_compare(phpversion(), '8.1.0', '<')) {
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.

While that's technically valid, could you replace that with this?:

PHP_VERSION_ID < 80100

It's more consistent with how phpseclib v3 does things and it's marginally faster as well.

Thanks!

lib/mcrypt.php Outdated
$reflectionProperty->setAccessible(true); // can be dropped in PHP 8.1.0+

if (version_compare(phpversion(), '8.1.0', '<')) {
$reflectionProperty->setAccessible(true); // can be dropped in PHP 8.1.0+
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.

I guess we don't need that comment anymore now that we have that if statement!

Copy link
Copy Markdown
Contributor Author

@shimooka shimooka left a comment

Choose a reason for hiding this comment

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

I've applied your suggestions.
Thanks :-)

Copy link
Copy Markdown
Contributor Author

@shimooka shimooka left a comment

Choose a reason for hiding this comment

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

Sorry... re-fixed typo

@terrafrost terrafrost merged commit 07064c8 into phpseclib:master Apr 8, 2026
@terrafrost
Copy link
Copy Markdown
Member

Apologies for the delay!

v2.0.8 has been released and includes your code changes!

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