Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

BUGFIX Fail silently in _t() legacy mode when using sprintf(), to avo…

…id 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
  • Loading branch information...
1 parent 69d3497 commit acfc658b4e6ffa422771fbc019435471dc6a60c3 @chillu chillu committed
Showing with 3 additions and 1 deletion.
  1. +3 −1 i18n/i18n.php
4 i18n/i18n.php
@@ -1524,7 +1524,9 @@ static function _t($entity, $string = "", $context = "", $injection = "") {
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.

0 comments on commit acfc658

Please sign in to comment.
Something went wrong with that request. Please try again.