Fixing Session::read using "isset" instead of "empty" session could have empty contents.

skala
Julio Montoya 12 years ago
parent e104eee054
commit d289aa1d7c
  1. 6
      main/inc/lib/chamilo_session.class.php

@ -26,8 +26,9 @@ class ChamiloSession
public static function read($variable, $default = null) public static function read($variable, $default = null)
{ {
$result = self::$session->get($variable); $result = self::$session->get($variable);
// check if the value exists in the $_SESSION array
if (empty($result)) { // Check if the value exists in the $_SESSION array, to keep BC.
if (!isset($result)) {
return isset($_SESSION[$variable]) ? $_SESSION[$variable] : $default; return isset($_SESSION[$variable]) ? $_SESSION[$variable] : $default;
} else { } else {
return $result; return $result;
@ -50,7 +51,6 @@ class ChamiloSession
*/ */
public static function erase($variable) public static function erase($variable)
{ {
$variable = (string) $variable;
self::$session->remove($variable); self::$session->remove($variable);
if (isset($GLOBALS[$variable])) { if (isset($GLOBALS[$variable])) {

Loading…
Cancel
Save