r40999 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40998‎ | r40999 | r41000 >
Date:17:21, 18 September 2008
Author:simetrical
Status:old
Tags:
Comment:
Fix for last commit

My last commit didn't catch anything but plain <ref>: <ref name="foo"> would be allowed. Fixed using a regex from the patch on bug 12757 by Max Semenik.
Modified paths:
  • /trunk/extensions/Cite/Cite_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Cite/Cite_body.php
@@ -155,10 +155,10 @@
156156 return $this->error( 'cite_error_ref_numeric_key' );
157157 }
158158
159 - if( strpos(
160 - preg_replace( '#<([^ ]+?).*?>.*?</\\1 *>|<!--.*?-->#', '', $str ),
161 - '<ref>'
162 - ) !== false ) {
 159+ if( preg_match(
 160+ '/<ref\b[^<]*?>/',
 161+ preg_replace( '#<([^ ]+?).*?>.*?</\\1 *>|<!--.*?-->#', '', $str )
 162+ ) ) {
163163 # (bug 6199) This most likely implies that someone left off the
164164 # closing </ref> tag, which will cause the entire article to be
165165 # eaten up until the next <ref>. So we bail out early instead.