Skip to content

Bug: $hash in User::SetPasswordHash not nullable  #1234

Open
@ludis

Description

@ludis

PHP Version

8.3.4

CodeIgniter4 Version

4.5.2

Shield Version

1.1.0

Which operating systems have you tested for this bug?

macOS

Which server did you use?

apache

Database

MySQL 5.7

Did you customize Shield?

No

What happened?

Create new user with password empty
User requests a login link

Error: CRITICAL - 2024-12-06 12:38:16 --> TypeError: CodeIgniter\Shield\Entities\User::setPasswordHash(): Argument #1 ($hash) must be of type string, null given

Steps to Reproduce

See 'what happened'

Expected Output

CodeIgniter\Shield\Entities\User::setPasswordHash() should accept NULL values I think.
Since private property $password_hash of class User is nullable.
Parameter $hash should be nullable, like this:
public function setPasswordHash(?string $hash)

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwaiting for infoIssues or pull requests that need further clarification from the author

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions