PHP Classes

Session check before starting session ...

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  How Can the PHP OAuth...  >  All threads  >  Session check before starting...  >  (Un) Subscribe thread alerts  
Subject:Session check before starting...
Summary:Session check before starting session ...
Messages:3
Author:vizo
Date:2013-03-31 02:38:53
Update:2013-03-31 07:20:02
 

  1. Session check before starting...   Reply   Report abuse  
Picture of vizo vizo - 2013-03-31 02:38:53
It should check if session is already started for integration with other applications ...
so i added in oauth_client.php on line 897 the following:

if (session_id() == '')
if(!session_start())
return($this->SetPHPError('it was not possible to start the PHP session', $php_error_message));


PHP 5.4 have a nicer solution to check (session_status() == PHP_SESSION_ACTIVE), but i think we should use this for now ...

Have a nice day,
vizo

  2. Re: Session check before starting...   Reply   Report abuse  
Picture of vizo vizo - 2013-03-31 02:41:22 - In reply to message 1 from vizo
I forgot to mention .. this is very annoying because it writes in log notice every time you login ... if session is already started :)

  3. Re: Session check before starting...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-03-31 07:20:02 - In reply to message 1 from vizo
Real implementations should create a sub-class and override the StoreAccessToken and GetAccessToken functions to use an application specific storage, like for instance a database.

The default implementation of the class uses sessions because it is available in all PHP Web installations and does not require further configuration.

However, if you need to call an API when the user is not present, sessions will not work, so the base class implementation of the access token storage functions will not work.