mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Fail silently in _t() legacy mode when using sprintf(), to avoid outdated translations breaking with a fatal error (e.g. CMSMain.ACCESS changed from two to one usage of {title}, which isn't changed yet in most languages). Slight performance overhead, but acceptable since its legacy usage only
This commit is contained in:
parent
69d3497497
commit
acfc658b4e
@ -1524,7 +1524,9 @@ class i18n extends Object implements TemplateGlobalProvider {
|
||||
if(!preg_match($regex, $returnValue)) {
|
||||
// Legacy mode: If no injection placeholders are found,
|
||||
// replace sprintf placeholders in fixed order.
|
||||
$returnValue = vsprintf($returnValue, array_values($injectionArray));
|
||||
// Fail silently in case the translation is outdated
|
||||
$replaced = @vsprintf($returnValue, array_values($injectionArray));
|
||||
if($replaced) $returnValue = $replaced;
|
||||
} else if(!ArrayLib::is_associative($injectionArray)) {
|
||||
// Legacy mode: If injection placeholders are found,
|
||||
// but parameters are passed without names, replace them in fixed order.
|
||||
|
Loading…
Reference in New Issue
Block a user