Fix Ifb93e49b
authorAlex Monk <krenair@gmail.com>
Wed, 13 Mar 2013 15:43:27 +0000 (15:43 +0000)
committerAlex Monk <krenair@gmail.com>
Wed, 13 Mar 2013 15:43:27 +0000 (15:43 +0000)
This commit caused a PHP notice if you tried to use diff=prev with an
oldid which was the first revision of the page.

Change-Id: I4c4ccb9a0c8d82e104723a2e72f1c699e2fc249b

includes/diff/DifferenceEngine.php

index 421bee9..0f3c77f 100644 (file)
@@ -267,6 +267,8 @@ class DifferenceEngine extends ContextSource {
                $deleted = $suppressed = false;
                $allowed = $this->mNewRev->userCan( Revision::DELETED_TEXT, $user );
 
+               $revisionTools = array();
+
                # mOldRev is false if the difference engine is called with a "vague" query for
                # a diff between a version V and its previous version V' AND the version V
                # is the first version of that article. In that case, V' does not exist.
@@ -292,7 +294,6 @@ class DifferenceEngine extends ContextSource {
                                $samePage = false;
                        }
 
-                       $revisionTools = array();
                        if ( $samePage && $this->mNewPage->quickUserCan( 'edit', $user ) ) {
                                if ( $this->mNewRev->isCurrent() && $this->mNewPage->userCan( 'rollback', $user ) ) {
                                        $rollbackLink = Linker::generateRollback( $this->mNewRev, $this->getContext() );