diff --git a/library/think/Template.php b/library/think/Template.php index c57ff89c..7d14e354 100644 --- a/library/think/Template.php +++ b/library/think/Template.php @@ -645,7 +645,7 @@ class Template */ public function parseAttr($str, $name = null) { - $regex = '/\s+(?>(?\w+)\s*)=(?>\s*)([\"\'])(?(?:(?!\\2).)*)\\2/is'; + $regex = '/\s+(?>(?[\w-]+)\s*)=(?>\s*)([\"\'])(?(?:(?!\\2).)*)\\2/is'; $array = []; if (preg_match_all($regex, $str, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { diff --git a/tests/thinkphp/library/think/templateTest.php b/tests/thinkphp/library/think/templateTest.php index b044a5b6..0cdc2757 100644 --- a/tests/thinkphp/library/think/templateTest.php +++ b/tests/thinkphp/library/think/templateTest.php @@ -257,7 +257,7 @@ EOF; $_GET['action'] = 'action'; $_POST['action'] = 'action'; $_COOKIE['name'] = 'name'; - \think\Session::set('action', ['name' => 'name']); + $_SESSION['action'] = ['name' => 'name']; define('SITE_NAME', 'site_name'); $content = <<