Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP openssl free key deprecated

Tags:

php

In php the function

openssl_free_key

is deprecated and not includde in php 8. Can somebody give an alternative for it?

like image 237
user2301515 Avatar asked Feb 28 '26 07:02

user2301515


1 Answers

This function is now deprecated as it doesn't have an effect anymore.

https://www.php.net/manual/en/function.openssl-free-key.php

PHP 8 deprecates openssl_free_key (actually openssl_pkey_free which it aliases) and automatically destroys the key instance when it goes out of scope.

https://www.php.net/manual/en/function.openssl-pkey-free.php#125655

So really you replace it with nothing, as the resource is now cleaned up properly the same as anything else.

If you want to feel like you're going that extra mile you can call unset() on it, but that's not a thing I would consider necessary.

like image 191
Sammitch Avatar answered Mar 03 '26 03:03

Sammitch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!