-
Notifications
You must be signed in to change notification settings - Fork 132
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: mysqli_sql_exception when using ->withIdentities() #512
Comments
Cannot reproduce with MySQL. $userModel = new UserModel();
$users = $userModel->like('username','never-match')
->withIdentities()
->findAll();
$this->assertSame([], $users); |
I tried also with Mysql 8.0.31 but still have the same error. My controller just extend the BaseController and use just the Shield UserModel: <?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Shield\Models\UserModel;
class Test extends BaseController
{
public function index()
{
$userModel = new UserModel();
$users = $userModel->like('username','never-match')
->withIdentities()
->findAll();
}
} This generate the error for me, on MariaDB and Mysql (I also upgraded Shield to dev-develop 32eb7e7). Thanks a lot and best regards |
Can someone try it against this branch of the framework which will supply the whole query in the error log? codeigniter4/CodeIgniter4#6195 |
The problem is here: https://github.com/codeigniter4/shield/blob/develop/src/Models/UserModel.php#L70 |
Sorry, I mistakenly thought it was MySQL, but it was SQLite.
SELECT *
FROM `shield_auth_identities`
WHERE `user_id` IN ()
ORDER BY `id` |
|
@virdb thanks for your report, the problem is now fixed, use the |
@datamweb you are welcome! Thanks to all for debugging and fixing |
PHP Version
7.4.32 | 8.1.12
CodeIgniter4 Version
4.2.10
Shield Version
dev-develop dd18be0
Which operating systems have you tested for this bug?
Linux
Which server did you use?
cli-server (PHP built-in webserver)
Database
MariaDB 10.9.3
Did you customize Shield?
No
What happened?
Consider this code in controller:
This works returning all not deleted usernames.
If I try to search a specific, existing user ("admin"), it also works finding the user:
Now, if I try the same search, but with a match that doesn't match any user, like:
It generate an error:
If I remove ->withIdentities(), it return an empty array
Steps to Reproduce
see previous description
Expected Output
empty array
Anything else?
No response
The text was updated successfully, but these errors were encountered: