Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 opened this issue Apr 8, 2024 · 6 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@jlopes90
Copy link
Contributor

jlopes90 commented Apr 8, 2024

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

@jlopes90 jlopes90 added the bug Something isn't working label Apr 8, 2024
@datamweb datamweb added the duplicate This issue or pull request already exists label Apr 8, 2024
@datamweb
Copy link
Collaborator

datamweb commented Apr 8, 2024

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

@kenjis kenjis changed the title Bug: Connection::_escapeString() Bug: TypeError: CodeIgniter\Database\MySQLi\Connection::_escapeString(): Argument #1 ($str) must be of type string, CodeIgniter\I18n\Time given Apr 8, 2024
@kenjis kenjis changed the title Bug: TypeError: CodeIgniter\Database\MySQLi\Connection::_escapeString(): Argument #1 ($str) must be of type string, CodeIgniter\I18n\Time given Bug: [CI 4.5.0] TypeError: CodeIgniter\Database\MySQLi\Connection::_escapeString(): Argument #1 ($str) must be of type string, CodeIgniter\I18n\Time given Apr 8, 2024
@kenjis kenjis pinned this issue Apr 9, 2024
@ay4t
Copy link

ay4t commented Apr 14, 2024

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

@samsonasik
Copy link
Member

CodeIgniter 4.5.1 already released, please update and verify

@warcooft
Copy link
Contributor

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
Copy link

ay4t commented Apr 14, 2024

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
Copy link
Member

kenjis commented Apr 14, 2024

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

@kenjis kenjis closed this as completed Apr 14, 2024
@datamweb datamweb unpinned this issue Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

6 participants