contao/import — Issue #3369: File/Folder Tree empty array causes problem.
Author: tsarma
Created: 2011-11-29 21:25:38+00:00
State: open
Labels: backend, Defect, Incomplete

I have in my extension's tl_setting.

```
$GLOBALS['TL_DCA']['tl_settings']['fields']['myFolderPath'] = array(
'label'	=> &$GLOBALS['TL_LANG']['tl_settings']['myFolderPath'],
'exclude'	=> true,
'inputType'	=> 'fileTree',
'eval'	=> array('fieldType'=>'radio', 'files'=>false, 'tl_class' => 'clr')
);
```

This don't work always, specially when eval, 'files' => false, After looking into error messages I have found in file backend/FileTree.php $this->varValue which is required to be an array is not always so.
When i change the line 319 from FileTree.php

```
$blnIsOpen = ($session[$node][$tid] == 1 || count(preg_grep('/^' . preg_quote($currentFolder, '/') . '\//', $this->varValue)) > 0);
```

to

```
$blnIsOpen = ($session[$node][$tid] == 1 || count(preg_grep('/^' . preg_quote($currentFolder, '/') . '\//', (is_array($this->varValue) ? $this->varValue : array()))) > 0);
```

it works. Can you please check this.
Thanks a lot.

--- _Originally created on August 15th, 2011, at 10:51am (ID 3369)_