symfony/symfony — Issue #2527: Twig reaches memory limit
Author: pluff
Created: 2011-10-31 16:30:21+00:00
State: open

Hello.

I met a problem with simple template overriding:
```Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 523800 bytes) in /var/www/memory/vendor/symfony/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php on line 98
```
It seems like Twig gets infinite loop or somthing like that.
I'm trying to create child bundle and override bundle template with [this manual](http://symfony.com/doc/2.0/cookbook/bundles/inheritance.html). My code is simple as:

>//MemoryParentBundle:DefaultController
>class DefaultController extends Controller
>{
> /**
> * @Route("/hello/")
> * @Template()
> */
> public function indexAction()
> {
> return array('name' => 'HELLO');
> }
>}
>
>//MemoryParentBundle:Default:index.html.twig
>Hello!
>
>//MemoryChildBundle.php
>class MemoryChildBundle extends Bundle
>{
> public function getParent()
> {
> return 'MemoryParentBundle';
> }
>}
>
>//MemoryChildBundle:DefaultController
>use Memory\Bundle\ParentBundle\Controller\DefaultController as Controller;
>class DefaultController extends Controller
>{
>}
>//MemoryChildBundle:Default:index.html.twig
>{% include 'MemoryParentBundle:Default:index.html.twig' %}
>world

I do have all necessary "use" statements. Removing "getParent" method will solve the problem, but manual tells to keep it. What does it used for? Or maybe I'm tring to inherrit parent template with some additions in wrong way?