修复了在php5.4以上版本中pcre库版本略低出现的preg_match或preg_match_all函数报无法识别字符错误,并且可以向上兼容

This commit is contained in:
舒博
2016-07-27 14:28:25 +08:00
parent b332e55dd2
commit 6e74935e84
2 changed files with 6 additions and 6 deletions

View File

@@ -224,7 +224,7 @@ class TagLib
*/
public function parseAttr($str, $name, $alias = '')
{
$regex = '/\s+(?>(?<name>[\w-]+)\s*)=(?>\s*)([\"\'])(?<value>(?:(?!\\2).)*)\\2/is';
$regex = '/\s+(?>(?P<name>[\w-]+)\s*)=(?>\s*)([\"\'])(?P<value>(?:(?!\\2).)*)\\2/is';
$result = [];
if (preg_match_all($regex, $str, $matches)) {
foreach ($matches['name'] as $key => $val) {