Skip to content

Commit

Permalink
Merge pull request #5443 from kenjis/refactor-array_helper
Browse files Browse the repository at this point in the history
refactor: dot_array_search() regex
  • Loading branch information
kenjis committed Dec 7, 2021
2 parents 64fc7c4 + 8cad094 commit 66e592c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion system/Helpers/array_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
*/
function dot_array_search(string $index, array $array)
{
$segments = preg_split('/(?<!\\\)\./', rtrim($index, '* '), 0, PREG_SPLIT_NO_EMPTY);
// See https://regex101.com/r/44Ipql/1
$segments = preg_split(
'/(?<!\\\\)\./',
rtrim($index, '* '),
0,
PREG_SPLIT_NO_EMPTY
);

$segments = array_map(static function ($key) {
return str_replace('\.', '.', $key);
Expand Down

0 comments on commit 66e592c

Please sign in to comment.