Permalink
Browse files

Safer way to prevent the array to string notice.

  • Loading branch information...
1 parent 84c980f commit 4f91465af74a8280b7a37e05e16d062e63bc016a @Phally Phally committed Sep 1, 2013
Showing with 1 addition and 5 deletions.
  1. +1 −5 lib/Cake/I18n/I18n.php
View
@@ -553,7 +553,7 @@ public static function loadLocaleDefinition($filename) {
$currentToken = $parts[0];
$value = $parts[1];
} elseif ($count == 1) {
- $value .= $parts[0];
+ $value = is_array($value) ? $parts[0] : $value . $parts[0];
} else {
continue;
}
@@ -575,15 +575,11 @@ public static function loadLocaleDefinition($filename) {
$val = str_replace($replacements, $mustEscape, $val);
$value[$i] = $val;
}
- $value = array_filter($value);
if (count($value) == 1) {
$definitions[$currentToken] = array_pop($value);
} else {
$definitions[$currentToken] = $value;
}
- if (empty($value)) {
- $value = '';
- }
}
return $definitions;

0 comments on commit 4f91465

Please sign in to comment.