This issue is automatically created based on existing pull request: #40688: fix: remove dead openssl_free_key() code path in JwkFactory
Description
Remove the dead openssl_free_key() code path from JwkFactory::freeResource().
Problem
The freeResource() method contains a version check that is always false:
if (\is_resource($resource) && (version_compare(PHP_VERSION, '8.0') < 0)) {
openssl_free_key($resource);
}
Since Magento requires PHP 8.3+, this condition can never be true. In PHP 8.0+, OpenSSL key resources were replaced with OpenSSLAsymmetricKey objects that are automatically freed by garbage collection, and openssl_free_key() was deprecated (removed in 8.5).
Solution
Remove the dead code path from the method body. The method signature is preserved since it is called from within the class.
Files Changed
lib/internal/Magento/Framework/Jwt/JwkFactory.php
⭐ Support my work
Do you like the fix? Remember to react with "👍🏻" to get it merged faster,
Then Sponsor me on Github so I can spend more time on fixing issues like this one.
Learn more at https://github.com/sponsors/lbajsarowicz
This issue is automatically created based on existing pull request: #40688: fix: remove dead openssl_free_key() code path in JwkFactory
Description
Remove the dead
openssl_free_key()code path fromJwkFactory::freeResource().Problem
The
freeResource()method contains a version check that is always false:Since Magento requires PHP 8.3+, this condition can never be true. In PHP 8.0+, OpenSSL key resources were replaced with
OpenSSLAsymmetricKeyobjects that are automatically freed by garbage collection, andopenssl_free_key()was deprecated (removed in 8.5).Solution
Remove the dead code path from the method body. The method signature is preserved since it is called from within the class.
Files Changed
lib/internal/Magento/Framework/Jwt/JwkFactory.php⭐ Support my work
Do you like the fix? Remember to react with "👍🏻" to get it merged faster,
Then Sponsor me on Github so I can spend more time on fixing issues like this one.
Learn more at https://github.com/sponsors/lbajsarowicz