Fixed Style Import Error

Naatan

Well-known member
Server Error

Undefined index: parent_list
  1. XenForo_Application::handlePhpError() in XenForo/Model/StyleProperty.php at line 616
  2. XenForo_Model_StyleProperty->rebuildPropertyCacheInStyleAndChildren() in XenForo/DataWriter/Style.php at line 155
  3. XenForo_DataWriter_Style->_postSave() in XenForo/DataWriter.php at line 1385
  4. XenForo_DataWriter->save() in XenForo/Model/Style.php at line 527
  5. XenForo_Model_Style->importStyleXml() in XenForo/ControllerAdmin/Style.php at line 181
  6. XenForo_ControllerAdmin_Style->actionImport() in XenForo/FrontController.php at line 310
  7. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
  8. XenForo_FrontController->run() in /portal/www/admin.php at line 13
 
Can you help me to reproduce this error? So far I haven't been able to. Any specific steps?

Sorry I'm no longer running the environment that had this problem, but if you look at the file mentioned (XenForo/Model/StyleProperty.php) at line 616 you can see that it's accessing the index 'parent_list', which if you look at line 604 could very well not have been defined. It's definitely a bug in XenForo, whether easily reproducible or not.
 
Sorry I'm no longer running the environment that had this problem, but if you look at the file mentioned (XenForo/Model/StyleProperty.php) at line 616 you can see that it's accessing the index 'parent_list', which if you look at line 604 could very well not have been defined. It's definitely a bug in XenForo, whether easily reproducible or not.

Yeah I see that in the code. I just like to be able to reproduce the problem so I can fully test it and confirm a fix. You are right though:

XenForo_Model_StyleProperty

Rich (BB code):
		foreach ($rebuildStyleIds AS $rebuildStyleId)
		{
			$sourceStyle = (isset($styles[$rebuildStyleId]) ? $styles[$rebuildStyleId] : array());

			switch ($rebuildStyleId)
			{
				case 0:
					continue 2;

				case -1:
					$sourceStyleIds = array(-1, 0);
					break;

				default:
					$sourceStyleIds = explode(',', $sourceStyle['parent_list']);
			}

			$styleProperties = array();
			foreach ($sourceStyleIds AS $sourceStyleId)
			{
				if (isset($properties[$sourceStyleId]))
				{
					$styleProperties = array_merge($styleProperties, $properties[$sourceStyleId]);
				}
			}
 
Top Bottom