From 23d072db94be4228e99873547910e1f1e682a4cb Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 2 Sep 2005 04:44:15 +0000 Subject: [PATCH] * (bug 3292) Fix move-over-redirect test when current entries are not plaintext Patch by Tietew: http://bugzilla.wikimedia.org/attachment.cgi?id=834&action=view --- RELEASE-NOTES | 1 + includes/Title.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b5cf346a80..4c50dfe441 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -77,6 +77,7 @@ fully support the editing toolbar, but was found to be too confusing. * Security fix for Special:Upload license selection list * Don't override edit conflict suppression on section edits; section merging should provide the expected transparency here and fits usage patterns better. +* (bug 3292) Fix move-over-redirect test when current entries are not plaintext === Caveats === diff --git a/includes/Title.php b/includes/Title.php index 9616051948..3c38f45021 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1866,7 +1866,7 @@ class Title { # Is it a redirect? $id = $nt->getArticleID(); $obj = $dbw->selectRow( array( 'page', 'revision', 'text'), - array( 'page_is_redirect','old_text' ), + array( 'page_is_redirect','old_text','old_flags' ), array( 'page_id' => $id, 'page_latest=rev_id', 'rev_text_id=old_id' ), $fname, 'FOR UPDATE' ); @@ -1874,14 +1874,18 @@ class Title { # Not a redirect return false; } + $text = Revision::getRevisionText( $obj ); # Does the redirect point to the source? - if ( preg_match( "/\\[\\[\\s*([^\\]\\|]*)]]/", $obj->old_text, $m ) ) { + if ( preg_match( "/\\[\\[\\s*([^\\]\\|]*)]]/", $text, $m ) ) { $redirTitle = Title::newFromText( $m[1] ); if( !is_object( $redirTitle ) || $redirTitle->getPrefixedDBkey() != $this->getPrefixedDBkey() ) { return false; } + } else { + # Fail safe + return false; } # Does the article have a history? -- 2.20.1