From cc95e09519323f91af4cd33b56c9bbdcc8d142b8 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Fri, 13 Dec 2013 12:15:39 -0500 Subject: [PATCH] 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 --- includes/WikiPage.php | 5 +++++ 1 file changed, 5 insertions(+) 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 ) -- 2.20.1