Fixed Importing a style errorexception

Affected version
2.2

Russ

Well-known member
Getting this error when importing a 2.1.0 Patch 2 compatible style onto a 2.2 Beta 1:

Code:
ErrorException: [E_WARNING] Invalid argument supplied for foreach() in src/XF/Service/Style/Import.php at line 193
XF::handlePhpError() in src/XF/Service/Style/Import.php at line 193
XF\Service\Style\Import->getAssetValues() in src/XF/Service/Style/Import.php at line 177
XF\Service\Style\Import->importAssets() in src/XF/Service/Style/Import.php at line 161
XF\Service\Style\Import->importFromXml() in src/XF/Admin/Controller/Style.php at line 434
XF\Admin\Controller\Style->actionImport() in src/XF/Mvc/Dispatcher.php at line 350
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 261
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 113
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 55
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2270
XF\App->run() in src/XF.php at line 417
XF::runApp() in admin.php at line 13
 

Chris D

XenForo developer
Staff member
You can probably just patch the XML file directly which might be easiest though I can give you a code patch if you prefer.

XML:
<?xml version="1.0" encoding="utf-8"?>
<style title="Default style" description="This is the default blue and orange liquid style that ships with the product." user_selectable="1" base_version_id="2020032" export_version="2">
  <assets/>
  <templates/>
  <properties/>
</style>

You'd basically just add <assets/> at the appropriate place (probably above your <templates> tag.
 

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.0 Beta 2).

Change log:
Prevent error when importing legacy style into XF 2.2.
There may be a delay before changes are rolled out to the XenForo Community.
 
Last edited by a moderator:
Top