Anomie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/101224


Change subject: Fix WikiPage::prepareContentForEdit's default format handling
......................................................................

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
---
M includes/WikiPage.php
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/24/101224/1

diff --git a/includes/WikiPage.php b/includes/WikiPage.php
index 7afc65c..0d987aa 100644
--- a/includes/WikiPage.php
+++ b/includes/WikiPage.php
@@ -2017,6 +2017,11 @@
                $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 )

-- 
To view, visit https://gerrit.wikimedia.org/r/101224
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ddcf6e388636e6a6397b664b8683ad774a09a04
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>

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

Reply via email to