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:
Ingo Schommer 2012-06-04 11:40:55 +02:00
parent 69d3497497
commit acfc658b4e

View File

@ -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.