Welcome Guest, Not a member yet? Register   Sign In
Problem in Phpsession library
#1

[eluser]Marcus Cavalcanti[/eluser]
I found a small bug in Phpsession library. When i save an object in session, when i retrieve this object it has the information: "object(__PHP_Incomplete_Class)"

To fix this problem, i modified the save() method of Phpsession class. The method fixed:

Code:
/* Save a session variable.
  * @paramstringName of variable to save
  * @parammixedValue to save
  * @paramstring  (optional) Namespace to use. Defaults to 'default'. 'flash' is reserved.
*/
function save($var, $val, $namespace = 'default') {
  if ($var == null) {
   if (is_object($val)) {
$_SESSION[$namespace] = (object) get_object_vars($val);
   } else {
$_SESSION[$namespace] = $val;
   }
  } else {
   if (is_object($val)) {
$_SESSION[$namespace][$var] = (object) get_object_vars($val);
   } else {
$_SESSION[$namespace][$var] = $val;
   }
  }
}

The cause of this problem is found there: http://www.thescripts.com/forum/threadedpost56014.html

Smile

Marcus Cavalcanti


Messages In This Thread
Problem in Phpsession library - by El Forum - 07-19-2007, 02:49 PM
Problem in Phpsession library - by El Forum - 11-06-2008, 04:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB