From: Brad Jorsch Date: Fri, 13 Dec 2013 17:15:39 +0000 (-0500) Subject: Fix WikiPage::prepareContentForEdit's default format handling X-Git-Tag: 1.31.0-rc.0~17646^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=cc95e09519323f91af4cd33b56c9bbdcc8d142b8;p=lhc%2Fweb%2Fwiklou.git Fix WikiPage::prepareContentForEdit's default format handling If some caller passes null for the $serialization_format parameter, they're going to break the in-memory caching of the prepared edit even though it's likely that the format being used is the same as the format being used by everything else. It seems sensible to cache null as the default format for the content object to avoid this. Bug: 57026 Change-Id: I4ddcf6e388636e6a6397b664b8683ad774a09a04 --- diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 7afc65c02d..0d987aa4c0 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -2017,6 +2017,11 @@ class WikiPage implements Page, IDBAccessObject { $user = is_null( $user ) ? $wgUser : $user; //XXX: check $user->getId() here??? + // Use a sane default for $serialization_format, see bug 57026 + if ( $serialization_format === null ) { + $serialization_format = $content->getContentHandler()->getDefaultFormat(); + } + if ( $this->mPreparedEdit && $this->mPreparedEdit->newContent && $this->mPreparedEdit->newContent->equals( $content )