r53607 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53606‎ | r53607 | r53608 >
Date:17:07, 21 July 2009
Author:brion
Status:ok
Tags:
Comment:
Cleanup for r53518 (subpage support for edit comments)
Reported bug: PHP Notice: Undefined variable: thelink in /var/www/w/includes/Linker.php on line 1090 on hitting http://translatewiki.net/w/i.php?title=Special:Log&dir=prev&user=Siebrand
Weren't properly checking for the case where we end up with an invalid link at the end.
Modified paths:
  • /trunk/phase3/includes/Linker.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -1053,6 +1053,7 @@
10541054 $text = $match[1];
10551055 }
10561056 $submatch = array();
 1057+ $thelink = null;
10571058 if( preg_match( '/^' . $medians . '(.*)$/i', $match[1], $submatch ) ) {
10581059 # Media link; trail not supported.
10591060 $linkRegexp = '/^(.*?)\]\]/';
@@ -1087,7 +1088,10 @@
10881089 ) . $trail;
10891090 }
10901091 }
1091 - $comment = preg_replace( $linkRegexp, StringUtils::escapeRegexReplacement( $thelink ), $comment, 1 );
 1092+ if( $thelink ) {
 1093+ // If the link is still valid, go ahead and replace it in!
 1094+ $comment = preg_replace( $linkRegexp, StringUtils::escapeRegexReplacement( $thelink ), $comment, 1 );
 1095+ }
10921096
10931097 return $comment;
10941098 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r53518Also treat [[#section]] links as expected with the 'local' param for diff vie...brion02:26, 20 July 2009

Status & tagging log