r44128 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44127‎ | r44128 | r44129 >
Date:21:35, 1 December 2008
Author:skizzerz
Status:deferred
Tags:
Comment:
* slight bugfix for RegexFunctions where the sanitation process misinterprets some things as internal options
Modified paths:
  • /trunk/extensions/RegexFunctions/RegexFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RegexFunctions/RegexFunctions.php
@@ -16,7 +16,7 @@
1717 'name' => 'RegexFunctions',
1818 'author' => 'Ryan Schmidt',
1919 'url' => 'http://www.mediawiki.org/wiki/Extension:RegexFunctions',
20 - 'version' => '1.2',
 20+ 'version' => '1.3',
2121 'description' => 'Regular Expression parser functions',
2222 'descriptionmsg' => 'regexfunctions-desc',
2323 );
@@ -123,7 +123,7 @@
124124 //santizes a regex pattern
125125 function sanitize($pattern, $m = false, $e = false) {
126126 if(preg_match('/^\/(.*)([^\\\\])\/(.*?)$/', $pattern, $matches)) {
127 - $pat = preg_replace('/([^\\\\])?\(\?(.*)(\:.*)?\)/Ue', '\'$1(?\' . $this->cleanupInternal(\'$2\') . \'$3)\'', $matches[1] . $matches[2]);
 127+ $pat = preg_replace('/([^\\\\])?\(\?(.*\:)?(.*)\)/Ue', '\'$1(?\' . $this->cleanupInternal(\'$2\') . \'$3)\'', $matches[1] . $matches[2]);
128128 $ret = '/' . $pat . '/';
129129 if($m) {
130130 $mod = '';
@@ -136,7 +136,7 @@
137137 $ret .= $mod;
138138 }
139139 } else {
140 - $pat = preg_replace('/([^\\\\])?\(\?(.*)(\:.*)?\)/Ue', '\'$1(?\' . $this->cleanupInternal(\'$2\') . \'$3)\'', $pattern);
 140+ $pat = preg_replace('/([^\\\\])?\(\?(.*\:)?(.*)\)/Ue', '\'$1(?\' . $this->cleanupInternal(\'$2\') . \'$3)\'', $pattern);
141141 $pat = preg_replace('!([^\\\\])/!', '$1\\/', $pat);
142142 $ret = '/' . $pat . '/';
143143 }

Status & tagging log