]> git.wh0rd.org - patches.git/blob - darcs-check-preg-match.patch
initial import
[patches.git] / darcs-check-preg-match.patch
1 --- old-dokuwiki/inc/parser/lexer.php 2007-05-25 17:39:03.000000000 -0400
2 +++ new-dokuwiki/inc/parser/lexer.php 2007-05-25 17:39:03.000000000 -0400
3 @@ -112,11 +112,16 @@
4 return false;
5 }
6
7 - if (! preg_match($this->_getCompoundedRegex(), $subject, $matches)) {
8 + $match = preg_match($this->_getCompoundedRegex(), $subject, $matches);
9 + if (is_bool($match) && $match == false) {
10 + /* some problem occurred */
11 + return -1;
12 + } else if ($match == 0) {
13 $split = array($subject, "", "");
14 return false;
15 }
16
17 +
18 $idx = count($matches)-2;
19
20 list($pre, $post) = preg_split($this->_patterns[$idx].$this->_getPerlMatchingFlags(), $subject, 2);
21 @@ -535,7 +540,10 @@
22 if ($raw === "") {
23 return true;
24 }
25 - if ($action = $this->_regexes[$this->_mode->getCurrent()]->split($raw, $split)) {
26 + $action = $this->_regexes[$this->_mode->getCurrent()]->split($raw, $split);
27 + if (is_int($action) && $action == -1)
28 + return false;
29 + if ($action) {
30 list($unparsed, $match, $raw) = $split;
31 return array($unparsed, $match, $action);
32 }
33