From: daniel Date: Thu, 18 Oct 2012 17:37:26 +0000 (+0200) Subject: (Bug 41179) Missing content in EditPage::showDiff X-Git-Tag: 1.31.0-rc.0~21961^2 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=45dc0458b4a1f9c1a225a67bdbc9246c1eed9463;p=lhc%2Fweb%2Fwiklou.git (Bug 41179) Missing content in EditPage::showDiff Fixing another instance where the page content may be null. Change-Id: I2f377937892dcfa5389f768edfb6033d2e6196b4 --- 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 );