PHP7.4:preg_replace():编译失败:偏移量 0 处无法识别编译时选项位

Jan*_*tel 3 php

我们使用的是 ubuntu 20.04、PHP7.4 和 Azure SQL

消息:preg_replace():编译失败:偏移量 0 处无法识别编译时选项位

文件名:core/Common.php

线路号码:725

回溯:

文件:/var/www/html/api/index.php 行:316 函数:require_once

这是文件名中的代码:core/Common.php

function remove_invisible_characters($str, $url_encoded = TRUE)
    {
        $non_displayables = array();

        // every control character except newline (dec 10),
        // carriage return (dec 13) and horizontal tab (dec 09)
        if ($url_encoded)
        {
            $non_displayables[] = '/%0[0-8bcef]/i'; // url encoded 00-08, 11, 12, 14, 15
            $non_displayables[] = '/%1[0-9a-f]/i';  // url encoded 16-31
            $non_displayables[] = '/%7f/i'; // url encoded 127
        }

        $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S';   // 00-08, 11, 12, 14-31, 127

        do
        {
            $str = preg_replace($non_displayables, '', $str, -1, $count);
        }
        while ($count);

        return $str;
    }
}
Run Code Online (Sandbox Code Playgroud)

代码来自: 文件:/var/www/html/api/index.php 行:316 函数:require_once

require_once BASEPATH.'core/CodeIgniter.php';

Pie*_*hel 10

我有同样的问题,我发现了这个:https://bugs.php.net/bug.php ?id=81640

通过将 libpcre2-8-0 从版本 10.36 更新到 10.39,似乎可以解决该问题。我会尝试这一步

切勿在满月的晚上进行制作^^

  • 我确定 !> sudo apt-get install -y libpcre2-8-0 更新到 10.39 解决了这个问题 (2认同)