Skip to content

Commit fc80501

Browse files
committed
force typecast to array for array helper
1 parent e53b9dd commit fc80501

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/helper/ArrayMerge.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ public static function isAssoc($val) {
2020

2121
public static function mergeRecursive($array1, $array2)
2222
{
23-
foreach($array2 as $key=>$val) {
24-
if(isset($array1[$key])) {
25-
if(self::isAssoc($val)) {
23+
$array1 = (array)$array1;
24+
$array2 = (array)$array2;
25+
foreach ($array2 as $key => $val) {
26+
if (isset($array1[$key])) {
27+
if (self::isAssoc($val)) {
2628
$array1[$key] = self::mergeRecursive($array1[$key], $val);
2729
} else {
2830
$array1[$key] = $val;

0 commit comments

Comments
 (0)