소스 검색

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

Julio Montoya 11 년 전
부모
커밋
d289aa1d7c
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      main/inc/lib/chamilo_session.class.php

+ 3 - 3
main/inc/lib/chamilo_session.class.php

@@ -26,8 +26,9 @@ class ChamiloSession
     public static function read($variable, $default = null)
     {
         $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;
         } else {
             return $result;
@@ -50,7 +51,6 @@ class ChamiloSession
      */
     public static function erase($variable)
     {
-        $variable = (string) $variable;
         self::$session->remove($variable);
 
         if (isset($GLOBALS[$variable])) {