Skip to content

Commit c873c35

Browse files
committed
refactor: add \ for regex string
Both the string before and after the change are the same string in PHP, but I got a pattern error when I entered the string before the change in https://regex101.com/.
1 parent d68e7f3 commit c873c35

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

system/Helpers/array_helper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
*/
2121
function dot_array_search(string $index, array $array)
2222
{
23-
$segments = preg_split('/(?<!\\\)\./', rtrim($index, '* '), 0, PREG_SPLIT_NO_EMPTY);
23+
// See https://regex101.com/r/44Ipql/1
24+
$segments = preg_split('/(?<!\\\\)\./', rtrim($index, '* '), 0, PREG_SPLIT_NO_EMPTY);
2425

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

0 commit comments

Comments
 (0)