mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 12:36: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];
|
$currentToken = $parts[0];
|
||||||
$value = $parts[1];
|
$value = $parts[1];
|
||||||
} elseif ($count == 1) {
|
} elseif ($count == 1) {
|
||||||
$value .= $parts[0];
|
$value = is_array($value) ? $parts[0] : $value . $parts[0];
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -575,15 +575,11 @@ class I18n {
|
||||||
$val = str_replace($replacements, $mustEscape, $val);
|
$val = str_replace($replacements, $mustEscape, $val);
|
||||||
$value[$i] = $val;
|
$value[$i] = $val;
|
||||||
}
|
}
|
||||||
$value = array_filter($value);
|
|
||||||
if (count($value) == 1) {
|
if (count($value) == 1) {
|
||||||
$definitions[$currentToken] = array_pop($value);
|
$definitions[$currentToken] = array_pop($value);
|
||||||
} else {
|
} else {
|
||||||
$definitions[$currentToken] = $value;
|
$definitions[$currentToken] = $value;
|
||||||
}
|
}
|
||||||
if (empty($value)) {
|
|
||||||
$value = '';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $definitions;
|
return $definitions;
|
||||||
|
|
Loading…
Add table
Reference in a new issue