r84259 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84258‎ | r84259 | r84260 >
Date:19:16, 18 March 2011
Author:midom
Status:ok (Comments)
Tags:
Comment:
eliminate PCRE recursion from URL check
Modified paths:
  • /branches/wmf/1.17wmf1/languages/Language.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/languages/Language.php
@@ -1780,8 +1780,7 @@
17811781 return $s;
17821782 }
17831783
1784 - $isutf8 = preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
1785 - '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
 1784+ $isutf8 = ( $s == iconv("UTF-8","UTF-8//IGNORE", $s));
17861785 if ( $isutf8 ) {
17871786 return $s;
17881787 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r85536Merge from 1.17wmf1: r84259demon13:50, 6 April 2011
r85537Merge from 1.17wmf1: r84259demon13:53, 6 April 2011

Comments

#Comment by Reedy (talk | contribs)   00:25, 16 April 2011

Per Special:Code/MediaWiki/85536#c15772

Any suggestions of a more general fix? :)

#Comment by Midom (talk | contribs)   17:36, 16 April 2011
  • shrug*, implement the utf-8 validation without PCRE and put it for this iconv use case into iconv wrapper :-)

do note, iconv wrapper support already breaks every character support except latin1, so maybe non-iconv clients just shouldn't have this functionality.

Status & tagging log