r48802 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48801‎ | r48802 | r48803 >
Date:10:55, 25 March 2009
Author:werdna
Status:resolved
Tags:
Comment:
Remove OBSOLETE file for PasswordReset
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.parser.php (modified) (history)
  • /trunk/extensions/PasswordReset/OBSOLETE (deleted) (history)

Diff [purge]

Index: trunk/extensions/PasswordReset/OBSOLETE
@@ -1,4 +0,0 @@
2 -This extension is obsolete as of r46769, its functionality has been implemented
3 -in core. Related right: 'reset-passwords'.
4 -
5 -In the future this extension may be removed from trunk.
Index: trunk/extensions/AbuseFilter/AbuseFilter.parser.php
@@ -794,9 +794,8 @@
795795
796796 // Spaces
797797 $matches = array();
798 - if ( preg_match( '/\s+/u', $code, $matches, PREG_OFFSET_CAPTURE, $offset ) &&
799 - $matches[0][1] == $offset ) {
800 - $offset += strlen($matches[0][0]);
 798+ if ( preg_match( '/\s+/uA', $code, $matches, 0, $offset ) ) {
 799+ $offset += strlen($matches[0]);
801800 }
802801
803802 if( $offset >= strlen($code) ) return array( '', AFPToken::TNone, $code, $offset );
@@ -825,7 +824,8 @@
826825 if( $code[$offset] == '"' || $code[$offset] == "'" ) {
827826 $type = $code[$offset];
828827 $offset++;
829 - while( $offset < strlen($code) ) {
 828+ $strLen = $len = strlen($code);
 829+ while( $offset < $strLen ) {
830830
831831 if( $code[$offset] == $type ) {
832832 $offset++;
@@ -839,16 +839,22 @@
840840 $tok .= substr( $code, $offset, $addLength );
841841 $offset += $addLength;
842842 } elseif( $code[$offset] == '\\' ) {
843 - if( $code[$offset + 1] == '\\' )
 843+ switch( $code[$offset + 1] ) {
 844+ case '\\':
844845 $tok .= '\\';
845 - elseif( $code[$offset + 1] == $type )
 846+ break;
 847+ case $type:
846848 $tok .= $type;
847 - elseif( $code[$offset + 1] == 'n' )
 849+ break;
 850+ case 'n';
848851 $tok .= "\n";
849 - elseif( $code[$offset + 1] == 'r' )
 852+ break;
 853+ case 'r':
850854 $tok .= "\r";
851 - elseif( $code[$offset + 1] == 't' )
 855+ break;
 856+ case 't':
852857 $tok .= "\t";
 858+ break;
853859 elseif( $code[$offset + 1] == 'x' ) {
854860 $chr = substr( $code, $offset + 2, 2 );
855861
@@ -882,15 +888,15 @@
883889
884890 foreach( self::$mOps as $op )
885891 $quoted_operators[] = preg_quote( $op, '/' );
886 - $operator_regex = '/('.implode('|', $quoted_operators).')/';
 892+ $operator_regex = '/('.implode('|', $quoted_operators).')/A';
887893 }
888894
889895 $matches = array();
890896
891 - preg_match( $operator_regex, $code, $matches, PREG_OFFSET_CAPTURE, $offset );
 897+ preg_match( $operator_regex, $code, $matches, 0, $offset );
892898
893 - if( count( $matches ) && $matches[0][1] == $offset ) {
894 - $tok = $matches[0][0];
 899+ if( count( $matches ) ) {
 900+ $tok = $matches[0];
895901 $offset += strlen( $tok );
896902 return array( $tok, AFPToken::TOp, $code, $offset );
897903 }
@@ -907,14 +913,14 @@
908914 10 => '[0-9.]',
909915 );
910916 $baseClass = '['.implode('', array_keys($bases)).']';
911 - $radixRegex = "/([0-9A-Fa-f]*(?:\.\d*)?)($baseClass)?/u";
 917+ $radixRegex = "/([0-9A-Fa-f]*(?:\.\d*)?)($baseClass)?/Au";
912918 $matches = array();
913919
914 - preg_match( $radixRegex, $code, $matches, PREG_OFFSET_CAPTURE, $offset );
 920+ preg_match( $radixRegex, $code, $matches, 0, $offset );
915921
916 - if ( count( $matches ) && $matches[0][1] == $offset ) {
917 - $input = $matches[1][0];
918 - $baseChar = @$matches[2][0];
 922+ if ( count( $matches ) ) {
 923+ $input = $matches[1];
 924+ $baseChar = @$matches[2];
919925 $num = null;
920926
921927 // Sometimes the base char gets mixed in with the rest of it because
@@ -961,12 +967,11 @@
962968 // The rest are considered IDs
963969
964970 // Regex match > PHP
965 - $idSymbolRegex = '/[0-9A-Za-z_]+/';
 971+ $idSymbolRegex = '/[0-9A-Za-z_]+/A';
966972 $matches = array();
967 - preg_match( $idSymbolRegex, $code, $matches, PREG_OFFSET_CAPTURE, $offset );
968973
969 - if ( $matches[0][1] == $offset ) {
970 - $tok = $matches[0][0];
 974+ if ( preg_match( $idSymbolRegex, $code, $matches, 0, $offset ) ) {
 975+ $tok = $matches[0];
971976
972977 $type = in_array( $tok, self::$mKeywords )
973978 ? AFPToken::TKeyword
@@ -1201,4 +1206,4 @@
12021207 return preg_match("#^".strtr(preg_quote($pattern, '#'), array('\*' => '.*', '\?' => '.'))."$#i", $string);
12031208 } // end
12041209
1205 -} // end if
\ No newline at end of file
 1210+} // end if

Follow-up revisions

RevisionCommit summaryAuthorDate
r48803Revert half-done patch from r48802werdna10:57, 25 March 2009

Status & tagging log