PHP5 Class problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm using PHP 5.0.3 and if a problem if a class method. I'm initializing a 
class like that:

$o_SessionHandler = new SessionHandler();
var_dump($o_SessionHandler->getOrgSession());exit;

Now it get the error message: 
Fatal error: Using $this when not in object context 
in /srv/www/htdocs/SessionHandler.class.php on line 68

I try to debug that but that looks like a bug in the parser. The class looks 
like that:

<?php

//-- interface for SessionHandler Class
interface SessionHandlerI
{
     //-- functions 
     static public function checkTime();
     static public function checkSession();
     static public function defineVar();
     static public function getVar();
     static public function isLogined();
     static public function getOrgSession();
}

//-- define SessionHandler Class
class SessionHandler implements SessionHandlerI
{
     //-- define var that keeps the original Session alive
     private $a_session_org;
     
     //-- initialize function
     public function SessionHandler()
     {
           $this->a_session_org = $_SESSION;
     }
     
     //-- function that checks how long the user don't do something
     static public function checkTime()
     {
          //-- check if time var exists
          if(isset($_SESSION['time_last_clicked']))
          {
               //-- check the time differents
               if(time() - $_SESSION['time_last_clicked'] < 
TIME_LOGOUT_IF_NO_CLICK)
               {
                    //-- set new time
                    $_SESSION['time_last_clicked'] = time();
               }
               else
               {
                    //-- block to login site
                    Blocker::BlockToLoginSite();
               }
          }
          else
          {
               //-- set var
               $_SESSION['time_last_clicked'] = time();
          }
     }
     
     //-- function that checks if the Session Structur is correct
     static public function checkSession(){}

     //-- function that defines a var in the Session
     static public function defineVar(){}

     //-- functino that returns a session var
     static public function getVar(){}

     //-- check if the user is logined based on the session
     static public function isLogined(){}

     //-- returns the original login
     static public function getOrgSession()
     {
          //-- return var
          return $this->a_session_org;
     }
}


The getOrgSession() function is inside of a class so the $this should be 
avaible... 

any ideas?
thanks!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux