N°1990 Fix setup crash when class has an empty zlist tag (eg. <details />)

Compiler crashed due to PHP warning being output depending on the error reporting level.
This commit is contained in:
Molkobain
2019-01-29 10:33:56 +01:00
parent 3ff6374ace
commit 3b16d33775

View File

@@ -598,10 +598,18 @@ EOF
/**
* Helper to form a valid ZList from the array built by GetNodeAsArrayOfItems()
*
* @param array $aItems
*/
protected function ArrayOfItemsToZList(&$aItems)
{
// Note: $aItems can be null in some cases so we have to protect it otherwise a PHP warning will be thrown during the foreach
if(!is_array($aItems))
{
$aItems = array();
}
$aTransformed = array();
foreach ($aItems as $key => $value)
{
if (is_null($value))
@@ -1834,6 +1842,10 @@ EOF
if ($oListNode)
{
$aAttributes = $oListNode->GetNodeAsArrayOfItems();
if(!is_array($aAttributes))
{
$aAttributes = array();
}
$this->ArrayOfItemsToZList($aAttributes);
$sZAttributes = var_export($aAttributes, true);