Fixed exceptions on attempts to serialize DatabaseSqlite. Encountered today by Nike...
authorMax Semenik <maxsem@users.mediawiki.org>
Thu, 29 Jul 2010 18:17:11 +0000 (18:17 +0000)
committerMax Semenik <maxsem@users.mediawiki.org>
Thu, 29 Jul 2010 18:17:11 +0000 (18:17 +0000)
includes/db/DatabaseSqlite.php

index f0de5df..ef99dc4 100644 (file)
@@ -34,6 +34,16 @@ class DatabaseSqlite extends DatabaseBase {
                }
        }
 
+       /**
+        * Serialization handler, see http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep
+        * for details. Instances of this class sometimes get serialized, e.g. with Title and its BacklinkCache
+        * Because attempts to serialize mConn end in "can't serialize PDO objects" exceptions, we simply disallow
+        * to serialize anything in this class.
+        */
+       function __sleep() {
+               return array();
+       }
+
        function getType() {
                return 'sqlite';
        }