From be46a1fdee51f3ddee58225d74401ab3fe993d19 Mon Sep 17 00:00:00 2001 From: Ercan Ozkaya Date: Tue, 16 Sep 2014 18:19:35 +0300 Subject: [PATCH] re #91: PHP 5.2 fix --- code/libraries/koowa/libraries/legacy.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/code/libraries/koowa/libraries/legacy.php b/code/libraries/koowa/libraries/legacy.php index 8cb5e225e..222f0b78a 100644 --- a/code/libraries/koowa/libraries/legacy.php +++ b/code/libraries/koowa/libraries/legacy.php @@ -27,9 +27,9 @@ function lcfirst( $str ) if (!function_exists('array_replace_recursive')) { - function array_replace_recursive($array, $array1) + if (!function_exists('recurse')) { - function recurse($array, $array1) + function recurse_for_array_replace($array, $array1) { foreach ($array1 as $key => $value) { @@ -40,7 +40,7 @@ function recurse($array, $array1) // overwrite the value in the base array if (is_array($value)) { - $value = recurse($array[$key], $value); + $value = recurse_for_array_replace($array[$key], $value); } $array[$key] = $value; @@ -48,6 +48,10 @@ function recurse($array, $array1) return $array; } + } + + function array_replace_recursive($array, $array1) + { // handle the arguments, merge one by one $args = func_get_args(); @@ -59,7 +63,7 @@ function recurse($array, $array1) for ($i = 1; $i < count($args); $i++) { if (is_array($args[$i])) { - $array = recurse($array, $args[$i]); + $array = recurse_for_array_replace($array, $args[$i]); } } return $array;