From 45dc0458b4a1f9c1a225a67bdbc9246c1eed9463 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 18 Oct 2012 19:37:26 +0200 Subject: [PATCH] (Bug 41179) Missing content in EditPage::showDiff Fixing another instance where the page content may be null. Change-Id: I2f377937892dcfa5389f768edfb6033d2e6196b4 --- includes/EditPage.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 4a1e5170f5..8f9d39480d 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2602,16 +2602,26 @@ HTML $this->section, $textboxContent, $this->summary, $this->edittime ); - ContentHandler::runLegacyHooks( 'EditPageGetDiffText', array( $this, &$newContent ) ); - wfRunHooks( 'EditPageGetDiffContent', array( $this, &$newContent ) ); + if ( $newContent ) { + ContentHandler::runLegacyHooks( 'EditPageGetDiffText', array( $this, &$newContent ) ); + wfRunHooks( 'EditPageGetDiffContent', array( $this, &$newContent ) ); - $popts = ParserOptions::newFromUserAndLang( $wgUser, $wgContLang ); - $newContent = $newContent->preSaveTransform( $this->mTitle, $wgUser, $popts ); + $popts = ParserOptions::newFromUserAndLang( $wgUser, $wgContLang ); + $newContent = $newContent->preSaveTransform( $this->mTitle, $wgUser, $popts ); + } if ( ( $oldContent && !$oldContent->isEmpty() ) || ( $newContent && !$newContent->isEmpty() ) ) { $oldtitle = wfMessage( $oldtitlemsg )->parse(); $newtitle = wfMessage( 'yourtext' )->parse(); + if ( !$oldContent ) { + $oldContent = $newContent->getContentHandler()->makeEmptyContent(); + } + + if ( !$newContent ) { + $newContent = $oldContent->getContentHandler()->makeEmptyContent(); + } + $de = $oldContent->getContentHandler()->createDifferenceEngine( $this->mArticle->getContext() ); $de->setContent( $oldContent, $newContent ); -- 2.20.1