Explorar o código

Fix unserialization of Predis/Connection/PhpiredisStreamConnection.

Daniele Alessandri %!s(int64=12) %!d(string=hai) anos
pai
achega
76d6681f68
Modificáronse 1 ficheiros con 18 adicións e 2 borrados
  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'));
     }
 }