Fixed Data portability : error on export when UTF8MB4 chars (emojis in username) [Invalid Character Error in src/XF/Service/User/Export.php at line 42]

Jean-Baptiste

Well-known member
Affected version
2.0.7
Hello,

When a username is containing emojis in it's username, and I export the user with the new data portability feature, it is throwing the following error :

DOMException: Invalid Character Error in src/XF/Service/User/Export.php at line 42
  1. DOMDocument->createElement() in src/XF/Service/User/Export.php at line 42
  2. XF\Service\User\Export->exportEntry() in src/XF/Service/AbstractXmlExport.php at line 38
  3. XF\Service\AbstractXmlExport->export() in src/XF/ControllerPlugin/Xml.php at line 25
  4. XF\ControllerPlugin\Xml->actionExport() in src/XF/Admin/Controller/DataPortability.php at line 40
  5. XF\Admin\Controller\DataPortability->actionExport() in src/XF/Mvc/Dispatcher.php at line 249
  6. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 87
  7. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
  8. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1931
  9. XF\App->run() in src/XF.php at line 328
  10. XF::runApp() in admin.php at line 13

Best regards
 
Last edited:
I don't see to have an issue generating XML files containing emoji:
XML:
<?xml version="1.0" encoding="utf-8"?>
<data_portability_user>
  <user username="Chris 🤪"
I guess it could be related to PHP version, which version are you guys running?

Either way, we'll just strip the emoji here to be safe.
 
Top Bottom