mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 00:48:25 +00:00
Safer way to prevent the array to string notice.
This commit is contained in:
parent
84c980f1f4
commit
4f91465af7
1 changed files with 1 additions and 5 deletions
|
@ -553,7 +553,7 @@ class I18n {
|
|||
$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 @@ class I18n {
|
|||
$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;
|
||||
|
|
Loading…
Add table
Reference in a new issue