Jump to content


Photo

error 500 Error Message: Function mcrypt_create_iv() is deprecated

staff response

  • Please log in to reply
2 replies to this topic

#1 xfactor

xfactor

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 11 April 2017 - 10:41 PM

Ok...I tried to do another fresh install after several issues and getting error 500 Error Message: Function mcrypt_create_iv() is deprecated

 

I can finally at least get into login screen but now getting this message when I try to login. I double checked and I did input correct login. 

 

I checked the error log and here are the findings: [error] [php] Function mcrypt_create_iv() is deprecated (/home/getrealcrm/public_html/x2crm/x2engine/protected/components/util/PasswordUtil.php:127)

 

Followed that path and here are lines of code in reference:

 

public static function createSalt() {
        if (function_exists('mcrypt_create_iv')) {
            return base64_encode(mcrypt_create_iv(self::PBKDF2_SALT_BYTES,
                            MCRYPT_DEV_URANDOM));
        } elseif (function_exists('openssl_random_pseudo_bytes')) {
            $random = openssl_random_pseudo_bytes(self::PBKDF2_SALT_BYTES, $strong);
            if ($strong === true) {
                return base64_encode($random);

 

I really want to test out this crm but seems to be alot of trouble with installing.



#2 X2Raymond

X2Raymond

    Advanced Member

  • Administrators
  • 902 posts
  • LocationSanta Cruz, CA

Posted 12 April 2017 - 11:41 AM

Ah I see, it sounds like you're using PHP version 7.1.0 or newer, as they have deprecated that function in favor of more cryptographically secure functions. Please see https://secure.php.n...t-create-iv.phpfor further detail.

 

Please try a reinstall with the following patch to the createSalt() method in protected/components/util/PasswordUtil.php and let me know how it goes:

     public static function createSalt() {
-        if (function_exists('mcrypt_create_iv')) {
+        if (version_compare(PHP_VERSION, '7.0.0') >= 0 && function_exists('random_bytes')) {
+            return base64_encode(random_bytes(self::PBKDF2_SALT_BYTES));
+        } elseif (function_exists('mcrypt_create_iv')) {

This will allow random_bytes() to be used when appropriate, falling back on the existing methods if unavailable.



#3 X2Raymond

X2Raymond

    Advanced Member

  • Administrators
  • 902 posts
  • LocationSanta Cruz, CA

Posted 20 April 2017 - 10:49 AM

Hello,

 

Just wanted to follow up on your PHP7 compatibility issue in createSalt(). Were you able to alleviate your issue by applying the provided patch?

 

Thanks!

Raymond







Also tagged with one or more of these keywords: staff response

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users