Skip to content

Conversation

@rodrigopedra
Copy link
Contributor

Continuation of #57580

As noted by @decadence in their comment #57580 (comment)

This function returns false for valid 0 key or I'm missing something? For example:

$array = [1, 2, 3];

data_has($array, "0"); // wrong false

That is due to empty($target) evaluating to true if the $key is a string equal to '0'.

This PR:

  • Fixes the test for an empty key
  • Adds more assertions to the data_has test case

Thanks @decadence

@taylorotwell taylorotwell merged commit 01eedf4 into laravel:12.x Oct 30, 2025
68 checks passed
@rodrigopedra rodrigopedra deleted the fix-data_has branch October 30, 2025 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants