PHP Classes

function gc() and newSid()

Recommend this page to a friend!

      My Session  >  All threads  >  function gc() and newSid()  >  (Un) Subscribe thread alerts  
Subject:function gc() and newSid()
Summary:PDO warnings/errors
Date:2012-03-26 07:02:22

  1. function gc() and newSid()   Reply   Report abuse  
Picture of John John - 2012-03-26 07:02:22
Hi there,

two lines might cause problems, because PDO wants variables. Two changes made:

function gc($maxlifetime)
LINE: $this->SQLStatement_DeleteExpiredSession->bindParam('time', time() - $this->session_max_duration, PDO::PARAM_INT);

Fatal error: Cannot pass parameter 2 by reference in ...

changed to:
$ti= time() - $this->session_max_duration;
$this->SQLStatement_DeleteExpiredSession->bindParam('time', $ti , PDO::PARAM_INT);

private function newSid() {
LINE: $this->SQLStatement_InsertSession->bindParam(':ua', $this->getUa(), PDO::PARAM_STR, 40);

[System Suggest] (Only variables should be passed by reference).

changed to:
$ua = $this->getUa();
$this->SQLStatement_InsertSession->bindParam(':ua', $ua, PDO::PARAM_STR, 40);

Have a nice day. Regards from Germany.