浏览代码

Fix unserialization of Predis/Connection/PhpiredisStreamConnection.

Daniele Alessandri 12 年之前
父节点
当前提交
76d6681f68
共有 1 个文件被更改,包括 18 次插入2 次删除
  1. 18 2
      lib/Predis/Connection/PhpiredisStreamConnection.php

+ 18 - 2
lib/Predis/Connection/PhpiredisStreamConnection.php

@@ -60,6 +60,16 @@ class PhpiredisStreamConnection extends StreamConnection
         parent::__construct($parameters);
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    public function __destruct()
+    {
+        phpiredis_reader_destroy($this->reader);
+
+        parent::__destruct();
+    }
+
     /**
      * Checks if the phpiredis extension is loaded in PHP.
      */
@@ -171,10 +181,16 @@ class PhpiredisStreamConnection extends StreamConnection
      * {@inheritdoc}
      */
     public function __sleep()
+    {
+        return array_diff(parent::__sleep(), array('mbiterable'));
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function __wakeup()
     {
         $this->checkExtensions();
         $this->initializeReader();
-
-        return array_diff(parent::__sleep(), array('mbiterable'));
     }
 }