aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-01-25 21:05:35 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-01-25 21:05:35 +0100
commitaf942739137cd1c95c052157c1f44ea6d605f4c3 (patch)
treea4ce5f0ecf36b25b8398009d2d370e1d2c1f69cb /lib
parentd4a2f6e313f08167ab39f500024593c3e2b4aa5c (diff)
More PHP 5.2 install compatibility
https://github.com/FreshRSS/FreshRSS/issues/1055
Diffstat (limited to 'lib')
-rw-r--r--lib/lib_rss.php24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 4852f7217..457fada3d 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -16,19 +16,19 @@ if (!function_exists('json_encode')) {
}
if (!function_exists('array_replace_recursive')) {
- function array_replace_recursive($array, $array1) { //http://php.net/manual/function.array-replace-recursive.php#92574
- function recurse($array, $array1) {
- foreach ($array1 as $key => $value) {
- if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key]))) {
- $array[$key] = array(); //create new key in $array, if it is empty or not an array
- }
- if (is_array($value)) {
- $value = recurse($array[$key], $value); // overwrite the value in the base array
- }
- $array[$key] = $value;
+ function arr_recurse($array, $array1) {
+ foreach ($array1 as $key => $value) {
+ if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key]))) {
+ $array[$key] = array(); //create new key in $array, if it is empty or not an array
}
- return $array;
+ if (is_array($value)) {
+ $value = arr_recurse($array[$key], $value); // overwrite the value in the base array
+ }
+ $array[$key] = $value;
}
+ return $array;
+ }
+ function array_replace_recursive($array, $array1) { //http://php.net/manual/function.array-replace-recursive.php#92574
// handle the arguments, merge one by one
$args = func_get_args();
$array = $args[0];
@@ -37,7 +37,7 @@ if (!function_exists('array_replace_recursive')) {
}
for ($i = 1; $i < count($args); $i++) {
if (is_array($args[$i])) {
- $array = recurse($array, $args[$i]);
+ $array = arr_recurse($array, $args[$i]);
}
}
return $array;