Skip to content

fix: return false from ArrayHelper::dotHas() for a wildcard over an empty array - #10789

Open
paulbalandan wants to merge 1 commit into
codeigniter4:4.8from
paulbalandan:dothas-empty-wildcard
Open

paulbalandan wants to merge 1 commit into
codeigniter4:4.8from
paulbalandan:dothas-empty-wildcard

Conversation

@paulbalandan

Copy link
Copy Markdown
Member

Description
Follow-up to #10757.

On 4.8 that method is dotHas(), and the rewrite already handles the zero key and non-array intermediate values from that fix. It still differed in one case: a wildcard over an empty array returned true, because the loop over its entries never ran. For example, dotHas('*.name', []) was true, and so was dotHas('contacts.friends.*.name', ['contacts' => ['friends' => []]]).

A wildcard now needs at least one entry to match, so both calls return false, as dotKeyExists() does on develop.

Checklist:

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

@carson-codeigniter4 carson-codeigniter4 Bot added 4.8 PRs that target the `4.8` branch. bug Verified issues on the current code behavior or pull requests that will fix them labels Nov 19, 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

4.8 PRs that target the `4.8` branch. bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants