Przeglądaj źródła

ZF-6072
- Zend_Session::namespaceUnset() cleans up single instances

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@15641 44c647ce-9c0f-0410-b52a-842ac1e357ba

ralph 16 lat temu
rodzic
commit
1cd59194fe
2 zmienionych plików z 20 dodań i 0 usunięć
  1. 1 0
      library/Zend/Session.php
  2. 19 0
      library/Zend/Session/Namespace.php

+ 1 - 0
library/Zend/Session.php

@@ -807,6 +807,7 @@ class Zend_Session extends Zend_Session_Abstract
     public static function namespaceUnset($namespace)
     {
         parent::_namespaceUnset($namespace);
+        Zend_Session_Namespace::resetSingleInstance($namespace);
     }
 
 

+ 19 - 0
library/Zend/Session/Namespace.php

@@ -71,6 +71,25 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
     protected static $_singleInstances = array();
 
     /**
+     * resetSingleInstance()
+     *
+     * @param string $namespaceName
+     * @return null
+     */
+    public static function resetSingleInstance($namespaceName = null)
+    {
+        if ($namespaceName != null) {
+            if (array_key_exists($namespaceName, self::$_singleInstances)) {
+                unset(self::$_singleInstances[$namespaceName]);
+            }
+            return;
+        }
+        
+        self::$_singleInstances = array();
+        return;
+    }
+    
+    /**
      * __construct() - Returns an instance object bound to a particular, isolated section
      * of the session, identified by $namespace name (defaulting to 'Default').
      * The optional argument $singleInstance will prevent construction of additional