bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.27k stars 7.61k forks source link

Crazy error, php-api/system/database/DB_driver.php --------> function escape($str) error #6242

Closed buzai closed 1 year ago

buzai commented 1 year ago

Crazy error, why does the string become empty, resulting in no query results?

    function escape($str)
    {
        error_log("======escape function Name - " . var_export($str, true));

        if (is_string($str))
        {
            error_log("=====is_string======escape");
            $str = "'".$this->escape_str($str)."'";
        }
        elseif (is_bool($str))
        {
            $str = ($str === FALSE) ? 0 : 1;
        }
        elseif (is_null($str))
        {
            $str = 'NULL';
        }
        error_log("========================== function Name - " . var_export($str, true));

        return $str;
    }
buzai commented 1 year ago

Additional note, I use docker and the same code works without problems on macOS but gives problems on ubuntu

buzai commented 1 year ago

Additional note, I use docker and the same code works without problems on macOS but gives problems on ubuntu

buzai commented 1 year ago

There is no problem under k8s. I don’t know why there is a bug in docker under ubuntu.

omerimzali commented 1 year ago

The issue is not clear to find a clue what's the reason of the issue.

  1. Which PHP version do you use?
  2. Do you use the same php image for macOS and Ubuntu?
  3. Could you share some str values and expected values and wrong output values?