From 44247c19c68a2d3539e1aa31d82e411ce3117660 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Thu, 29 Jul 2010 18:17:11 +0000 Subject: [PATCH] Fixed exceptions on attempts to serialize DatabaseSqlite. Encountered today by Nike, earlier seen during unit tests. Not implementing __wakeup() because restoring a connection along with its full state would just cause obscure bugs. If null mConn will cause problems (unlikely, because most instances of db object serialization are accidental and the connection is not supposed to be used after deserialization), we'll tweak specific classes that store database objects. --- includes/db/DatabaseSqlite.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index f0de5df010..ef99dc4c5b 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -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'; } -- 2.20.1