Skip to content

fix: allow null in User::setIdentities() - #1383

Open
wakqasahmed wants to merge 1 commit into
codeigniter4:developfrom
wakqasahmed:fix/issue-1302-nullable-set-identities
Open

wakqasahmed wants to merge 1 commit into
codeigniter4:developfrom
wakqasahmed:fix/issue-1302-nullable-set-identities

Conversation

@wakqasahmed

Copy link
Copy Markdown

Description

Fixes #1302

$identities is ?array and null is what tells getIdentities() to reload from the database, but setIdentities() only accepted array. So in a subclass of User, where the private property isn't reachable, $this->identities = null goes through the entity setter and throws a TypeError. Same for $user->identities = null from outside.

As discussed in the issue, this changes the signature to setIdentities(?array $identities), and adds a test that setting identities to null makes the next read pick up a newly added identity.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@datamweb datamweb added the bug Something isn't working label Oct 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Assigning null to ?array $identities property without proper handling

2 participants