Jump to content

Erreurs avec PHP 7.1


jbo14

Recommended Posts

Hello,

 

J'utilise prestashop 1.6.1.12 avec PHP 7.1.3 et j'ai plusieurs erreurs dans les logs apache

 

 

- Deprecated: Function mcrypt_decrypt() is deprecated in /var/www/html/classes/Rijndael.php on line 68

 

- PHP Notice:  A non well formed numeric value encountered in /var/www/html/tools/pclzip/pclzip.lib.php on line 1845

   => on fait des operations arithmétiques avec memory_limit qui n'est pas un numéric

 

-  PHP Notice:  A non well formed numeric value encountered in /var/www/html/classes/Uploader.php on line 122

 

Link to comment
Share on other sites

You are right. I'm testing PrestaShop 1.6.1.12 on PHP 7.1.1.0 and I have the same results... On 1.6.1.12 release page, we have a "change log" page (view here) where, at the core section, they said that Compatibility with 7.1 was fixed. Deprecation of "mcrypt_decrypt()" PHP function was requested and announced from the beginning of PHP7, so a solution (if any, since there is no replacement for that function) could be found until today... In Prestashop 1.7 things are better since is used open ssl encryption

To get ride of those warnings provided by "pclzip.lib.php on line 1845":

a) edit with a text editor the file "pclzip.lib.php" and comment out the line 1845 (put two slashes in front of the line)

B) add the following line, just after the commented one: $v_memory_limit = preg_replace("/[^0-9.]/", "", trim($v_memory_limit));

 

The same for the class "Uploader.php"

a) edit with a text editor the file "Uploader.php" and comment out the line 122

B) add the following line, just after the commented one: $bytes  = preg_replace("/[^0-9.]/", "", trim($post_max_size));

 

This warning is provided by the way the function "ini_get" read the php.ini file. Each of those vars that trigger a Notice, are represented in PHP initialization file  by a number followed by a letter (G for gigabyte, M for Megabytes and K for kilobytes. e.g post_max_size=5M). Before PHP 7, the multiplication function use to get only the numeric part of the operators. Since PHP 7 is "more strict", despite the fact that the math operation is done, a notice message is send. Those added lines eliminate any alpha character from the future operator, leaving only digits and decimal separator(if any).

By modifying core files you will get a temporary solution (Not recommended). Upgrading to another version of Prestashop you will loose these modifications.

 

For Rjindael class, things are different. You get a warning message to let you find an alternative to "mcrypt_encrypt()" and "mcrypt_decrypt()" PHP functions because, in the future PHP releases, those functions will be removed for good, so upgrading to PHP 7.2 you will not get a warning anymore but an error... Switching to Blowfish instead Rjindael encryption, in Advanced parameters > Preformance, (your cookie will be reset and the cookie encryption/decryption process is slower than Rjindael) you will not get anymore that warning.

Hope this helps a little...

Edited by bitwise (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...