http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70151

Revision: 70151
Author:   maxsem
Date:     2010-07-29 18:17:11 +0000 (Thu, 29 Jul 2010)

Log Message:
-----------
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: trunk/phase3/includes/db/DatabaseSqlite.php
===================================================================
--- trunk/phase3/includes/db/DatabaseSqlite.php 2010-07-29 18:03:25 UTC (rev 
70150)
+++ trunk/phase3/includes/db/DatabaseSqlite.php 2010-07-29 18:17:11 UTC (rev 
70151)
@@ -34,6 +34,16 @@
                }
        }
 
+       /**
+        * 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';
        }



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to