After an update from Magento 1.7 to 1.9.1
.I get the following error:
Array (
[type] = 2 [message] = vsprintf(): Too few arguments [file] /home/admin/domains/domainname.com/public_html/app/code/core/Mage/Core/Model/Translate.php [line] = 416
)
On line 416 this line is visible: $result = @vsprintf($translated, $args);
Does anyone know how i can solve this?
Below the full code of the function
/**
* Translate
*
* @param array $args
* @return string
*/
public function translate($args)
{
$text = array_shift($args);
if (is_string($text) && ''==$text
|| is_null($text)
|| is_bool($text) && false===$text
|| is_object($text) && ''==$text->getText()) {
return '';
}
if ($text instanceof Mage_Core_Model_Translate_Expr) {
$code = $text->getCode(self::SCOPE_SEPARATOR);
$module = $text->getModule();
$text = $text->getText();
$translated = $this->_getTranslatedString($text, $code);
}
else {
if (!empty($_REQUEST['theme'])) {
$module = 'frontend/default/'.$_REQUEST['theme'];
} else {
$module = 'frontend/default/default';
}
$code = $module.self::SCOPE_SEPARATOR.$text;
$translated = $this->_getTranslatedString($text, $code);
}
//array_unshift($args, $translated);
//$result = @call_user_func_array('sprintf', $args);
$result = @vsprintf($translated, $args);
if ($result === false) {
$result = $translated;
}
if ($this->_translateInline && $this->getTranslateInline()) {
if (strpos($result, '{{{')===false || strpos($result, '}}}')===false || strpos($result, '}}{{')===false) {
$result = '{{{'.$result.'}}{{'.$translated.'}}{{'.$text.'}}{{'.$module.'}}}';
}
}
return $result;
}
index.php
file and was throwing this error. You might want to replace the file with fresh one.