Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

sprintf() error on eCommerce

Go to End

3 Posts   2060 Views


SilverStripe Developer, 65 Posts

22 April 2008 at 9:04am


One step closer to getting the 0.5.2 rc1 eCommerce up and running - but i've hit a brick wall with this XML Parsing error.

I have been told to enable i18n, which I have done - set the locale to en_US, db/build?flush=1 and the error still appears. I'm lost!



Community Member, 13 Posts

28 April 2008 at 2:36pm

Am not sure if you have found the answer to your question, but just in case you haven't and for anyone else out there, try this:

navigate to \sapphire\core\SSViewer.php, locate the following lines:

// i18n
$content = ereg_replace('<' . '% +_t\((\'([^\']*)\'|"([^"]*)")(([^)]|\)[^ ]|\) +[^% ])*)\) +%' . '>', '<?= _t(\''. $path[1] . '.\\2\\3\'\\4) ?>', $content);

right below that look for:

// i18n - sprintf => "sprintf(_t(...),$argument)"
// CAUTION: No spaces allowed between arguments!
$content = ereg_replace('<' . '% +sprintf\(_t\((\'([^\']*)\'|"([^"]*)")(([^)]|\)[^ ]|\) +[^% ])*)\),\<\?= +([^\?]*) +\?\>) +%' . '>', '<?= sprintf(_t(\''. $path[1] . '.\\2\\3\'\\4),\\6) ?>', $content);

if you don't find it, then include it (make sure you place it right below).

OR just use the lastest version of SSviewer.php in trunk.

Hope this helps somebody out there.


SilverStripe Developer, 65 Posts

28 April 2008 at 3:04pm

Edited: 28/04/2008 3:36pm

Thank you.

I think it worked!