contao/import — Issue #2730: FileTree Widget - Warning, if Widget-value is no array with data stored in File
Author: importer
Created: 2011-11-29 20:04:54+00:00
State: open
Labels: backend, Defect, Invalid

With the webshop-module from fruitMedia installed, the fileTree-widget warns about the object variable value not being an array.

```
Warning: preg_grep() expects parameter 2 to be array, null given in [...]/system/modules/backend/FileTree.php on line 319
```

A quick lookup in system/modules/backend/FileTree.php brought the conclusion, that $this->varValue is wrapped with an array before calling the renderFiletree()-method, when the data is received from the database. With dataContainer == 'file', it isn't.

A possible solution to this would be inserting the array-wrap-code from around line 224 to line 206, resulting in the following code from

```
if ($GLOBALS['TL_DCA'][$this->strTable]['config']['dataContainer'] == 'File')
{
return $this->renderFiletree(TL_ROOT.'/'.$folder, ($level * 20), $mount);
}
```

to

```
if ($GLOBALS['TL_DCA'][$this->strTable]['config']['dataContainer'] == 'File')
{
if (!is_array($this->varValue))
{
$this->varValue = array($this->varValue);
}
return $this->renderFiletree(TL_ROOT.'/'.$folder, ($level * 20), $mount);
}
```

--- _Originally created by nininho on December 10th, 2010, at 11:00am (ID 2730)_