Iam trying to use sessionHandler to write and read session so i can use openssl_encrypt() and openssl_decrypt() but when i use in my class public session read() it shows me in vs red line under the method and if i use any method that exists in sessionHandler class it shows my that there're somthing wrong .. so how can i extends sessionHandler clase and use its methods ?
class SessionManager extends SessionHandler
{
private $sessionName = 'MYAPPSESSION';
private $sessionMaxLifetime = 0;
private $sessionSSL = false;
private $sessionHTTPOnly = true;
private $sessionPath = "/";
private $sessionDomain = ".mvcapp2.test";
private $sessionSavePath = SESSION_SAVE_PATH;
private $sessionCipherAlgo = "AES-128-ECB";
private $sessionCipherKey = "WQAS201VXZP@221D";
public function __construct()
{
ini_set('session.use_cookies', 1);
ini_set('session.use_only_cookies', 1);
ini_set('session.use_trans_sid', 0);
ini_set('session.save_handler', "files");
session_name($this->sessionName);
session_save_path($this->sessionSavePath);
session_set_cookie_params(
$this->sessionMaxLifetime,
$this->sessionPath,
$this->sessionDomain,
$this->sessionSSL,
$this->sessionHTTPOnly
);
session_set_save_handler($this, true);
}
public function read($id)
{
return openssl_decrypt(parent::read($id), $this->sessionCipherAlgo, $this->sessionCipherKey);
}
public function write($id, $data)
{
return parent::write($id, openssl_encrypt($data, $this->sessionCipherAlgo, $this->sessionCipherKey));
}
public function start()
{
if ("" === session_id()) {
return session_start();
}
}
}
try as follow:
and