From 6e74935e84d0182e30ce478710c3fa20f9f6458c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=88=92=E5=8D=9A?= Date: Wed, 27 Jul 2016 14:28:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=9C=A8php5.4?= =?UTF-8?q?=E4=BB=A5=E4=B8=8A=E7=89=88=E6=9C=AC=E4=B8=ADpcre=E5=BA=93?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=95=A5=E4=BD=8E=E5=87=BA=E7=8E=B0=E7=9A=84?= =?UTF-8?q?preg=5Fmatch=E6=88=96preg=5Fmatch=5Fall=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E6=8A=A5=E6=97=A0=E6=B3=95=E8=AF=86=E5=88=AB=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E9=94=99=E8=AF=AF=EF=BC=8C=E5=B9=B6=E4=B8=94=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E5=90=91=E4=B8=8A=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Template.php | 10 +++++----- library/think/template/TagLib.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/library/think/Template.php b/library/think/Template.php index d9250971..9051ebe1 100644 --- a/library/think/Template.php +++ b/library/think/Template.php @@ -699,7 +699,7 @@ class Template */ public function parseAttr($str, $name = null) { - $regex = '/\s+(?>(?[\w-]+)\s*)=(?>\s*)([\"\'])(?(?:(?!\\2).)*)\\2/is'; + $regex = '/\s+(?>(?P[\w-]+)\s*)=(?>\s*)([\"\'])(?P(?:(?!\\2).)*)\\2/is'; $array = []; if (preg_match_all($regex, $str, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { @@ -1114,9 +1114,9 @@ class Template switch ($tagName) { case 'block': if ($single) { - $regex = $begin . '(?:' . $tagName . '\b(?>(?:(?!name=).)*)\bname=([\'\"])(?[\$\w\-\/\.]+)\\1(?>[^' . $end . ']*)|\/' . $tagName . ')' . $end; + $regex = $begin . '(?:' . $tagName . '\b(?>(?:(?!name=).)*)\bname=([\'\"])(?P[\$\w\-\/\.]+)\\1(?>[^' . $end . ']*)|\/' . $tagName . ')' . $end; } else { - $regex = $begin . '(?:' . $tagName . '\b(?>(?:(?!name=).)*)\bname=([\'\"])(?[\$\w\-\/\.]+)\\1(?>(?:(?!' . $end . ').)*)|\/' . $tagName . ')' . $end; + $regex = $begin . '(?:' . $tagName . '\b(?>(?:(?!name=).)*)\bname=([\'\"])(?P[\$\w\-\/\.]+)\\1(?>(?:(?!' . $end . ').)*)|\/' . $tagName . ')' . $end; } break; case 'literal': @@ -1142,9 +1142,9 @@ class Template $name = 'name'; } if ($single) { - $regex = $begin . $tagName . '\b(?>(?:(?!' . $name . '=).)*)\b' . $name . '=([\'\"])(?[\$\w\-\/\.\:@,\\\\]+)\\1(?>[^' . $end . ']*)' . $end; + $regex = $begin . $tagName . '\b(?>(?:(?!' . $name . '=).)*)\b' . $name . '=([\'\"])(?P[\$\w\-\/\.\:@,\\\\]+)\\1(?>[^' . $end . ']*)' . $end; } else { - $regex = $begin . $tagName . '\b(?>(?:(?!' . $name . '=).)*)\b' . $name . '=([\'\"])(?[\$\w\-\/\.\:@,\\\\]+)\\1(?>(?:(?!' . $end . ').)*)' . $end; + $regex = $begin . $tagName . '\b(?>(?:(?!' . $name . '=).)*)\b' . $name . '=([\'\"])(?P[\$\w\-\/\.\:@,\\\\]+)\\1(?>(?:(?!' . $end . ').)*)' . $end; } break; } diff --git a/library/think/template/TagLib.php b/library/think/template/TagLib.php index b0e40f57..101593bf 100644 --- a/library/think/template/TagLib.php +++ b/library/think/template/TagLib.php @@ -224,7 +224,7 @@ class TagLib */ public function parseAttr($str, $name, $alias = '') { - $regex = '/\s+(?>(?[\w-]+)\s*)=(?>\s*)([\"\'])(?(?:(?!\\2).)*)\\2/is'; + $regex = '/\s+(?>(?P[\w-]+)\s*)=(?>\s*)([\"\'])(?P(?:(?!\\2).)*)\\2/is'; $result = []; if (preg_match_all($regex, $str, $matches)) { foreach ($matches['name'] as $key => $val) {