Skip to content

Commit 7f5ca5f

Browse files
committed
fix: unexpected behavior
1 parent 6f3f8ac commit 7f5ca5f

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

system/Helpers/array_helper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ function _array_search_dot(array $indexes, array $array)
8989
return _array_search_dot($indexes, $array[$currentIndex]);
9090
}
9191

92-
// Otherwise we've found our match!
93-
return $array[$currentIndex];
92+
// Otherwise, not found.
93+
return null;
9494
}
9595
}
9696

tests/system/Helpers/ArrayHelperTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,16 @@ public function testArrayDotTooManyLevels()
4545
],
4646
];
4747

48-
$this->assertSame(23, dot_array_search('foo.bar.baz', $data));
48+
$this->assertNull(dot_array_search('foo.bar.baz', $data));
49+
}
50+
51+
public function testArrayDotTooManyLevelsWithWildCard()
52+
{
53+
$data = [
54+
'a' => [],
55+
];
56+
57+
$this->assertNull(dot_array_search('a.*.c', $data));
4958
}
5059

5160
/**

0 commit comments

Comments
 (0)