Skip to content

Commit

Permalink
re #91: PHP 5.2 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ercanozkaya committed Sep 16, 2014
1 parent 4ad1d1e commit be46a1f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions code/libraries/koowa/libraries/legacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -40,14 +40,18 @@ 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;
}

return $array;
}
}

function array_replace_recursive($array, $array1)
{

// handle the arguments, merge one by one
$args = func_get_args();
Expand All @@ -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;
Expand Down

0 comments on commit be46a1f

Please sign in to comment.