codeigniter4 / shield

Authentication and Authorization for CodeIgniter 4
https://shield.codeigniter.com
MIT License
351 stars 123 forks source link

Bug: [CI 4.5.0] TypeError: CodeIgniter\Database\MySQLi\Connection::_escapeString(): Argument #1 ($str) must be of type string, CodeIgniter\I18n\Time given #1092

Closed jlopes90 closed 3 months ago

jlopes90 commented 3 months ago

PHP Version

8.1

CodeIgniter4 Version

4.5.0

Shield Version

dev-develop

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

MySQL 5.6

Did you customize Shield?

No.

What happened?

When logging in and an error appears.

image

Steps to Reproduce

...

Expected Output

...

Anything else?

No response

datamweb commented 3 months ago

We are aware of this behavior. But so far no decision has been made to fix it. I believe this is related to CI4.5 and not Shield. For now, the temporary solution is as follows:

vendor\codeigniter4\framework\system\Database\BaseConnection.php:

    /**
     * Platform independent string escape.
     *
     * Will likely be overridden in child classes.
     */
    protected function _escapeString(string|\CodeIgniter\I18n\Time $str): string
    {
        return str_replace("'", "''", remove_invisible_characters($str, false));
    }

vendor\codeigniter4\framework\system\Database\MySQLi\Connection.php:

    /**
     * Platform-dependant string escape
     */
    protected function _escapeString(string|\CodeIgniter\I18n\Time $str): string
    {
        if (! $this->connID) {
            $this->initialize();
        }

        return $this->connID->real_escape_string((string)$str);
    }

duplicate: #1086

ay4t commented 3 months ago

me too i got same error, Has this been updated in the release version?

samsonasik commented 3 months ago

CodeIgniter 4.5.1 already released, please update and verify

warcooft commented 3 months ago

me too i got same error, Has this been updated in the release version?

Update ke CI 4.5.1 Tapi ada sedikit bug di validasi shield, ditunggu aja update minor nya.

ay4t commented 3 months ago

me too i got same error, Has this been updated in the release version?

Update ke CI 4.5.1 Tapi ada sedikit bug di validasi shield, ditunggu aja update minor nya.

makasi bang infonya

kenjis commented 3 months ago

Upgrade to CI v4.5.1 and Shield v1.0.3.