r99835 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99834‎ | r99835 | r99836 >
Date:01:33, 15 October 2011
Author:mglaser
Status:ok
Tags:
Comment:
follow-up to r98020. Throw MWException on attempt to serialize database.
Modified paths:
  • /trunk/phase3/includes/db/Database.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/Database.php
@@ -608,15 +608,13 @@
609609 }
610610 }
611611
612 - /**
613 - * Called by unserialize. Needed to reopen DB connection, which
614 - * is not saved by serialize.
 612+ /**
 613+ * Called by serialize. Throw an exception when DB connection is serialized.
 614+ * This causes problems on some database engines because the connection is
 615+ * not restored on unserialize.
615616 */
616 - public function __wakeup() {
617 - if ( $this->isOpen() ) {
618 - $this->open( $this->mServer, $this->mUser,
619 - $this->mPassword, $this->mDBname);
620 - }
 617+ public function __sleep() {
 618+ throw new MWException( 'Database serialization may cause problems, since the connection is not restored on wakeup.' );
621619 }
622620
623621 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r98020* restore DB connection after unserialization. This is needed in all DB varia...mglaser20:07, 24 September 2011

Status & tagging log