Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/mcrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,11 @@ function phpseclib_mcrypt_generic_deinit(Base &$td)
{
$reflectionObject = new \ReflectionObject($td);
$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!

$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!

}

if (!strlen($reflectionProperty->getValue($td))) {
trigger_error('mcrypt_generic_deinit(): Could not terminate encryption specifier', E_USER_WARNING);
return false;
Expand Down