编译失败:偏移量 4 处字符 class 中的无效范围

Compilation failed: invalid range in character class at offset 4

我使用 CI_Minifier,但在更新 PHP 后出现问题。

现在我在使用 preg_match 函数时收到错误消息。

if (!preg_match("/^[\w-:]+$/", $tag)) { #error line
    $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
    if ($this->char === '<') {
        $this->link_nodes($node, false);

        return true;
    }

    if ($this->char==='>') {
        $node->_[HDOM_INFO_TEXT] .= '>';
    }
    $this->link_nodes($node, false);
    $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next

    return true;
}

错误是:

Compilation failed: invalid range in character class at offset 4

转义连字符:

if (!preg_match("/^[\w\-:]+$/", $tag)) { 

或者放在class字符的开头:

if (!preg_match("/^[-\w:]+$/", $tag)) { 

或最后:

if (!preg_match("/^[\w:-]+$/", $tag)) {