Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-20437

Php Warning while clearing caches from console

    Details

      Description

      Hi. Whenever i try to clear my caches from cli i'm gettin a php warning. i use

      php ezpublish/console cache:clear --env=dev 
      

      and i get

      [ErrorException]                                                             
        Warning: Illegal offset type in isset or empty in .../vendor/ezsystems/ezpublish/eZ/Publish/Core/MVC/Legacy/Templati  
        ng/Twig/Environment.php line 38
      

      Somebody else experiencing the same? Thanks.

        Activity

        Hide
        Carlos Revillo added a comment - - edited

        More info.
        with xdebug i got the function calling the one throwing the exception. it happens to be a symfony one

        Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer
        

        the call to "our" loadTemplate is made from this line
        https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php#L62

        There is a call to

        $this->finder->findAllTemplates()
        

        which returns an array. i just made a print_r there to see the output, but i'm gonna add here just some lines

            [44] => Symfony\Bundle\FrameworkBundle\Templating\TemplateReference Object
                (
                    [parameters:protected] => Array
                        (
                            [bundle] => FrameworkBundle
                            [controller] => Form
                            [name] => field_errors
                            [format] => html
                            [engine] => php
                        )
         
                )
         
            [45] => Symfony\Bundle\FrameworkBundle\Templating\TemplateReference Object
                (
                    [parameters:protected] => Array
                        (
                            [bundle] => FrameworkBundle
                            [controller] => Form
                            [name] => field_rest
                            [format] => html
                            *[engine] => php*
                        )
         
                )
         
            [46] => Symfony\Bundle\FrameworkBundle\Templating\TemplateReference Object
                (
                    [parameters:protected] => Array
                        (
                            [bundle] => SecurityBundle
                            [controller] => Collector
                            [name] => security
                            [format] => html
                            *[engine] => twig*
                        )
         
                )
         
            [47] => Symfony\Bundle\FrameworkBundle\Templating\TemplateReference Object
                (
                    [parameters:protected] => Array
                        (
                            [bundle] => TwigBundle
                            [controller] => Exception
                            [name] => exception
                            [format] => txt
                            [engine] => twig
                        )
         
                )
         
            [48] => Symfony\Bundle\FrameworkBundle\Templating\TemplateReference Object
                (
                    [parameters:protected] => Array
                        (
                            [bundle] => TwigBundle
                            [controller] => Exception
                            [name] => error
                            [format] => atom
                            [engine] => twig
                        )
         
                )
        
        

        When the engine is php loop continue, but when is twig, then loadTemplate is called with an object... and so the issue appears.

        so maybe we can just add a condition to our load template condition to be sure we are not working with a class...

        Show
        Carlos Revillo added a comment - - edited More info. with xdebug i got the function calling the one throwing the exception. it happens to be a symfony one Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer the call to "our" loadTemplate is made from this line https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php#L62 There is a call to $this->finder->findAllTemplates() which returns an array. i just made a print_r there to see the output, but i'm gonna add here just some lines [44] => Symfony\Bundle\FrameworkBundle\Templating\TemplateReference Object ( [parameters:protected] => Array ( [bundle] => FrameworkBundle [controller] => Form [name] => field_errors [format] => html [engine] => php )   )   [45] => Symfony\Bundle\FrameworkBundle\Templating\TemplateReference Object ( [parameters:protected] => Array ( [bundle] => FrameworkBundle [controller] => Form [name] => field_rest [format] => html *[engine] => php* )   )   [46] => Symfony\Bundle\FrameworkBundle\Templating\TemplateReference Object ( [parameters:protected] => Array ( [bundle] => SecurityBundle [controller] => Collector [name] => security [format] => html *[engine] => twig* )   )   [47] => Symfony\Bundle\FrameworkBundle\Templating\TemplateReference Object ( [parameters:protected] => Array ( [bundle] => TwigBundle [controller] => Exception [name] => exception [format] => txt [engine] => twig )   )   [48] => Symfony\Bundle\FrameworkBundle\Templating\TemplateReference Object ( [parameters:protected] => Array ( [bundle] => TwigBundle [controller] => Exception [name] => error [format] => atom [engine] => twig )   ) When the engine is php loop continue, but when is twig, then loadTemplate is called with an object... and so the issue appears. so maybe we can just add a condition to our load template condition to be sure we are not working with a class...
        Hide
        Carlos Revillo added a comment -

        More info. imho, there is a bad comment on the related twig function. I added a issue in their github about. basically, i think that is possible that "our" loadTemplate functions could be receiving objects too, and this is the cause of the problem
        https://github.com/fabpot/Twig/issues/992

        Show
        Carlos Revillo added a comment - More info. imho, there is a bad comment on the related twig function. I added a issue in their github about. basically, i think that is possible that "our" loadTemplate functions could be receiving objects too, and this is the cause of the problem https://github.com/fabpot/Twig/issues/992
        Hide
        Carlos Revillo added a comment - - edited
        Show
        Carlos Revillo added a comment - - edited https://github.com/ezsystems/ezp-next/pull/224
        Show
        Jérôme Vieilledent (Inactive) added a comment - Fixed in master : https://github.com/ezsystems/ezp-next/commit/055fea434bc7aa383ad26470a49aaa6f12ab05e9

          People

          • Assignee:
            Unassigned
            Reporter:
            Carlos Revillo
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: