OSDN Git Service

BugTrack/2512 preg_replace with PCRE_UTF8 (/u) option (AutoLink)
[pukiwiki/pukiwiki.git] / lib / make_link.php
index 36063c6..73ade5f 100644 (file)
@@ -117,7 +117,7 @@ class InlineConverter
                $this->page   = $page;
                $this->result = array();
 
-               $string = preg_replace_callback('/' . $this->pattern . '/x',
+               $string = preg_replace_callback('/' . $this->pattern . '/x' . get_preg_u(),
                        array(& $this, 'replace'), $string);
 
                $arr = explode("\x08", make_line_rules(htmlsc($string)));
@@ -141,7 +141,8 @@ class InlineConverter
        function get_objects($string, $page)
        {
                $matches = $arr = array();
-               preg_match_all('/' . $this->pattern . '/x', $string, $matches, PREG_SET_ORDER);
+               preg_match_all('/' . $this->pattern . '/x' . get_preg_u(),
+                       $string, $matches, PREG_SET_ORDER);
                foreach ($matches as $match) {
                        $obj = $this->get_converter($match);
                        if ($obj->set($match, $page) !== FALSE) {
@@ -281,7 +282,7 @@ EOD;
 
                // Re-get true plugin name and patameters (for PHP 4.1.2)
                $matches = array();
-               if (preg_match('/^' . $this->pattern . '/x', $all, $matches)
+               if (preg_match('/^' . $this->pattern . '/x' . get_preg_u(), $all, $matches)
                        && $matches[1] != $this->plain) 
                        list(, $this->plain, $name, $this->param) = $matches;