简体   繁体   中英

PHP7.4 : preg_replace(): Compilation failed: unrecognised compile-time option bit(s) at offset 0

We are using ubuntu 20.04, PHP7.4, and Azure SQL

Message: preg_replace(): Compilation failed: unrecognised compile-time option bit(s) at offset 0

Filename: core/Common.php

Line Number: 725

Backtrace:

File: /var/www/html/api/index.php Line: 316 Function: require_once

This is the code from Filename: 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;
    }
}

Code from: File: /var/www/html/api/index.php Line: 316 Function: require_once

require_once BASEPATH.'core/CodeIgniter.php';

i have the same problem after updating php to 8.0.13 and 7.4.26. Seems to be a problem with php?

I can confirm this issue, it is related to the latest patch PHP versions. It could be from this fix... http://bugs.php.net/81424 PHP 8 changelog: https://www.php.net/ChangeLog-8.php#8.0.13

I have the same problem, and I found this: https://bugs.php.net/bug.php?id=81640

By updating libpcre2-8-0 from version 10.36 to 10.39 it seems to correct the problem. I will try this step

Never put on production one evening on the full moon ^^

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM