cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 1.9.1- vsprintf() Too few arguments in app/code/core/Mage/Core/Model/Translate.php line 416

Magento 1.9.1- vsprintf() Too few arguments in app/code/core/Mage/Core/Model/Translate.php line 416

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;
}
2 REPLIES 2

Re: Magento 1.9.1- vsprintf() Too few arguments in app/code/core/Mage/Core/Model/Translate.php line

I'm having the same problem. I'm not sure you are getting a blank white page for all your frontend pages too but I'm stuck. If no luck then going to have to install a fresh one.

Re: Magento 1.9.1- vsprintf() Too few arguments in app/code/core/Mage/Core/Model/Translate.php line

ini_set('error_reporting', E_ERROR);
register_shutdown_function("fatal_handler");
function fatal_handler() {
$error = error_get_last();
echo("<pre>");
print_r($error);
}

 

check for this code and remove it from index.php file