MediaWiki r21993 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r21992‎ | r21993 (on ViewVC)‎ | r21994 >
Date:14:53, 8 May 2007
Author:river
Status:old
Tags:
Comment:
(bug 9295) ImageMap extension produces PHP fatal error when given invalid link title
Modified paths:

Diff [purge]

Index: trunk/extensions/ImageMap/ImageMap_body.php
===================================================================
--- trunk/extensions/ImageMap/ImageMap_body.php	(revision 21992)
+++ trunk/extensions/ImageMap/ImageMap_body.php	(revision 21993)
@@ -124,6 +124,8 @@
 				$alt = trim( $m[2] );
 			} elseif ( preg_match( '/^ \[\[  ([^\]]*+) \]\] \w* $ /x', $link, $m ) ) {
 				$title = Title::newFromText( $m[1] );
+				if (is_null($title))
+					return self::error('imagemap_invalid_title', $lineNum);
 				$alt = $title->getFullText();
 			} elseif ( $wgImageMapAllowExternalLinks && ( in_array( substr( $link , 1 , strpos($link, '//' )+1 ) , $wgUrlProtocols ) || in_array( substr( $link , 1 , strpos($link, ':' ) ) , $wgUrlProtocols ) ) ) {
 				if ( preg_match( '/^ \[  ([^\s]*+)  \s  ([^\]]*+)  \] \w* $ /x', $link, $m ) ) {
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox