symfony/symfony — Issue #2817: [TwigBundle] Filesystem loader's use of baseclass is not entirely correct and causes warning
Author: jonathaningram
Created: 2011-12-08 23:44:39+00:00
State: open

In https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php#L36 because it does not call `parent::__construct()`, later in `findTemplate` the call to `parent::findTemplate()` is not going to work all the time because in https://github.com/fabpot/Twig/blob/master/lib/Twig/Loader/Filesystem.php#L123 `$paths` was never initialised as either a string or array in the subclass.

The error you will see is:

```
Warning: Invalid argument supplied for foreach() in /vendor/twig/lib/Twig/Loader/Filesystem.php line 123
```

I propose either checking and setting up `$paths` in `Twig_Loader_Filesystem::findTemplate` or in `TwigBundle\Loader\FilesystemLoader`, do this:

```php
locator = $locator;
$this->parser = $parser;
$this->cache = array();
}
```

Which is side-affect free since the array is empty.