Browse Source

i18n safer vsprintf (#5022)

Fix bug introduced by https://github.com/FreshRSS/FreshRSS/pull/4807
though only for the French i18n, wich has some `%` signs in the URL, making `vsprintf` to crash.

Only use `vsprintf`` when we call the translation with some parameters, otherwise skip it (probably faster as well).
Alexandre Alapetite 3 years ago
parent
commit
d105761fec
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lib/Minz/Translate.php

+ 1 - 1
lib/Minz/Translate.php

@@ -232,7 +232,7 @@ class Minz_Translate {
 		}
 
 		// Get the facultative arguments to replace i18n variables.
-		return vsprintf($translation_value, $args);
+		return empty($args) ? $translation_value : vsprintf($translation_value, $args);
 	}
 
 	/**