Skip to content

Instantly share code, notes, and snippets.

@herveguetin
Created May 26, 2014 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save herveguetin/93f726bde76f44188673 to your computer and use it in GitHub Desktop.
Save herveguetin/93f726bde76f44188673 to your computer and use it in GitHub Desktop.
Bugfix in Mage_Core_Model_Email_Template
<php
/**
* Parse variables string into array of variables
*
* @param string $variablesString
* @return array
*/
protected function _parseVariablesString($variablesString)
{
$variables = array();
if ($variablesString && is_string($variablesString)) {
$variablesString = str_replace("\n", '', $variablesString);
// Bugfixes - need to replace line break by nothing + need to remove leading comma for proper JSON decoding
$variablesString = str_replace("\r", '', $variablesString);
$variablesString = str_replace(",}", '}', $variablesString);
$variables = Zend_Json::decode($variablesString);
}
return $variables;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment