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] Time object when savin date (login, user, etc) with MySQLI driver #1086

Closed nicojmb closed 3 months ago

nicojmb commented 3 months ago

PHP Version

8.1

CodeIgniter4 Version

4.5.0

Shield Version

1.0.2

Which operating systems have you tested for this bug?

Linux

Which server did you use?

apache

Database

MariaDB 10.5.24

Did you customize Shield?

No

What happened?

In CI 4.5.0 it's forbidden pass an object to save value in MYSQL driver, the value must be a string, located in:

*** I think that is more easy fix in CI4 4.5.0 directly adding (string) before value.

Steps to Reproduce

Install CI 4.5.0 and login

Expected Output

Correct login

Anything else?

No response

kenjis commented 3 months ago

In CI 4.5.0 it's forbidden pass an object to save value in MYSQL driver, the value must be a string

Why?

datamweb commented 3 months ago

Why?

https://github.com/codeigniter4/CodeIgniter4/blob/457890659c6ed18488a89c14d642f28060d31101/system/Database/BaseConnection.php#L1384-L1391

https://github.com/codeigniter4/CodeIgniter4/blob/457890659c6ed18488a89c14d642f28060d31101/system/Database/MySQLi/Connection.php#L342-L352

kenjis commented 3 months ago

Hmmm, I didn't notice but there are many flows that the data passed to Model is not handled by timeToString().

The tests for #1027 passed just because CI did not use strict types.

GeneralFutz commented 3 months ago

I have similar issues after fix from #1087. Many places where Time::now() is being called and returning the object. Places that might have been Time::now()->format(Y-m-d H:m:s) in earlier versions . Temporary fix in those places seems to be getting to successful logins and registration.

kenjis commented 3 months ago

I sent:

kenjis commented 3 months ago

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