r70151 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70150‎ | r70151 | r70152 >
Date:18:17, 29 July 2010
Author:maxsem
Status:reverted
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/db/DatabaseSqlite.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseSqlite.php
@@ -34,6 +34,16 @@
3535 }
3636 }
3737
 38+ /**
 39+ * Serialization handler, see http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep
 40+ * for details. Instances of this class sometimes get serialized, e.g. with Title and its BacklinkCache
 41+ * Because attempts to serialize mConn end in "can't serialize PDO objects" exceptions, we simply disallow
 42+ * to serialize anything in this class.
 43+ */
 44+ function __sleep() {
 45+ return array();
 46+ }
 47+
3848 function getType() {
3949 return 'sqlite';
4050 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r75228Reverted r70151 and re-did what it was intended to do in a proper way: instea...maxsem11:16, 23 October 2010

Status & tagging log