Browse Source

Fix unserialization of Predis/Connection/PhpiredisStreamConnection.

Daniele Alessandri 12 năm trước cách đây
mục cha
commit
76d6681f68
1 tập tin đã thay đổi với 18 bổ sung2 xóa
  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'));
     }
 }