the php function mcrypt_get_block_size
has been deprecated of PHP 7.1.0.
PHP: mcrypt_get_block_size - Manual
Any hints on how I prevent that ?
the php function mcrypt_get_block_size
has been deprecated of PHP 7.1.0.
PHP: mcrypt_get_block_size - Manual
Any hints on how I prevent that ?
Deprecations to functions in PHP occur between versions - this is a good thing. One cannot actually prevent deprecation (without contributing to the project).
However, one can suppress the warnings that these deprecated functions throw. Of course, it is always better to update and refactor your code, but I think we're all aware that sometimes that might not be a possibility.
To suppress the warnings, one can edit their php.ini
configuration file's error_reporting
value to E_ALL & ~E_DEPRECATED & ~E_NOTICE
. This will show all errors with the exception of deprecation warnings, and notices.
If it's only one script that you need to suppress, you can add the line error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE);
at the top of the script. This will have the same effect, without affecting all PHP scripts in your environment.
A final, third option is to avoid using PHP versions >= 7.1.0, although one may also consider this a poor solution compared to refactoring the code.
Looking at other mcrypt-related questions, such as this one, it seems that there are openssl_* function alternatives?
See openssl_cipher_iv_length(), as a possible replacement?