-
Notifications
You must be signed in to change notification settings - Fork 145
Description
PHP Version
8.3.6
CodeIgniter4 Version
4.5.3
Shield Version
1.1.0
Which operating systems have you tested for this bug?
macOS
Which server did you use?
cli-server (PHP built-in webserver)
Database
MySQL
Did you customize Shield?
No
What happened?
When i get a request via a standard POST like $request = $this->request->getPost(); this strong_password validation work fine.
But on another case am am build a web app with svelte and and sending a fetch to my CI4 backend with json data like $request = (array) $this->request->getJSON();. This method then return an error message titled: TypeError: CodeIgniter\Shield\Entities\User::setEmail(): Argument #1 ($email) must be of type string, null given, called in
It works when using getPost but fail to work when using getJSON. I can only bypass this error is i remove strong_password validation rule.
Steps to Reproduce
Retrive a json data in array form
$request = (array) $this->request->getJSON();
Try to validation this incoming request
$rules = $this->getValidationRules();
if (! $this->validateData($request, $rules, [], config('Auth')->DBGroup)) {
$errors = $this->validator->getErrors();
return $this->failValidationErrors(array_shift($errors));
}Try to save validation data to you db (Remember to enable strong_password validation rule)
new User($request);
Expected Output
This should create a new user account on my database.
Anything else?
No response