Fixed  Language Importer hangs.

There seems to be an error when importing a language .xml with many phrases via the Language Importer.

Reproduce in debug mode:
1) Export the English (US) language (βeta 5) with all XenForo phrases.
2) Edit the downloaded file and change the title value to something else, ex.
<language title="English (US)"> to <language title="English (US)2">
3) Save and try to import the "new" language from the admin.php?languages/import page.

I get:
Mysqli statement execute error : Duplicate entry 'about-N' for key 'title'
  1. Zend_Db_Statement_Mysqli->_execute() in \htdocs\xenforo\library\Zend\Db\Statement.php at line 312
  2. Zend_Db_Statement->execute() in \htdocs\xenforo\library\Zend\Db\Adapter\Abstract.php at line 479
  3. Zend_Db_Adapter_Abstract->query() in \htdocs\xenforo\library\Zend\Db\Adapter\Abstract.php at line 574
  4. Zend_Db_Adapter_Abstract->insert() in \htdocs\xenforo\library\XenForo\DataWriter.php at line 1500
  5. XenForo_DataWriter->_insert() in \htdocs\xenforo\library\XenForo\DataWriter.php at line 1489
  6. XenForo_DataWriter->_save() in \htdocs\xenforo\library\XenForo\DataWriter.php[/B] at line 1291
  7. XenForo_DataWriter->save() in \htdocs\xenforo\library\XenForo\Model\Phrase.php at line 1071
  8. XenForo_Model_Phrase->importPhrasesXml() in \htdocs\xenforo\library\XenForo\Model\Language.php at line 594
  9. XenForo_Model_Language->importLanguageXml() in \htdocs\xenforo\library\XenForo\ControllerAdmin\Language.php at line 267
  10. XenForo_ControllerAdmin_Language->actionImport() in \htdocs\xenforo\library\XenForo\FrontController.php at line 310
  11. XenForo_FrontController->dispatch() in \htdocs\xenforo\library\XenForo\FrontController.php at line 132
  12. XenForo_FrontController->run() in \htdocs\xenforo\admin.php at line 13
If I split the file (remove half of the phrases), it will get imported, no matter which phrases got deleted. I played with the php and mysql config files, but hadn't any luck.


Active member
I'm getting the same error, when I try to import a language as new language. When I first create a new language and then overwrite it with the same import-file I get no error and all is fine.

I have a XAMPP setup on OS X.6.


XenForo developer
Staff member
I just ran into this - it's actually triggering what appears to be a bug in PHP with SimpleXML. It manifests itself in really strange ways. However, I stumbled upon this using way more queries than it should, and fixing that seems to have resolved this issue.