Post by ozstar » Thu Oct 22, 2020 2:01 pm

Hi,

What could this mean and how to correct please?

We have just moved the site to another host.

Unknown: Function mcrypt_create_iv() is deprecated in /home/bettaaut/public_html/system/library/encryption.php on line 8

oz

Active Member

Posts

Joined
Fri Mar 09, 2012 7:47 am
Location - Sydney OZ

User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by ozstar » Sat Oct 24, 2020 1:10 pm

Many thanks.

The links show that a script was written for session.php but I am not sure if I add it to the default system/library/session.php or replace it or ?

This is the default..

Code: Select all

<?php
class Session {
	public $data = array();
			
	public function __construct() {
		if (!session_id()) {
			ini_set('session.use_cookies', 'On');
			ini_set('session.use_trans_sid', 'Off');
			
			session_set_cookie_params(0, '/');
			session_start();
		}
			
		$this->data =& $_SESSION;
	}
	
	function getId() {
		return session_id();
	}
}
?>
This is the new script..

Code: Select all

 system/library/session.php
@@ -58,14 +58,10 @@ public function getId() {
    }

    public function createId() {
        if (method_exists($this->adaptor, 'create_sid')) {
            return $this->adaptor->create_sid();
        } elseif (function_exists('random_bytes')) {
        if (function_exists('random_bytes')) {
            return substr(bin2hex(random_bytes(26)), 0, 26);
        } elseif (function_exists('openssl_random_pseudo_bytes')) {
            return substr(bin2hex(openssl_random_pseudo_bytes(26)), 0, 26);
        } else {
            return substr(bin2hex(mcrypt_create_iv(26, MCRYPT_DEV_URANDOM)), 0, 26);
        }
    }

Thanks

Active Member

Posts

Joined
Fri Mar 09, 2012 7:47 am
Location - Sydney OZ

Post by Naheed » Mon Oct 26, 2020 8:11 pm

The only possible reason for getting such an error is due to the fact that the mcrypt PHP extension is either:
Not loaded or
Not installed at all.

User avatar
New member

Posts

Joined
Mon Aug 10, 2020 11:19 pm
Who is online

Users browsing this forum: No registered users and 17 guests