Uploaded image for project: 'eZ Platform Enterprise Edition'
  1. eZ Platform Enterprise Edition
  2. EZEE-3356

Exception is thrown on controller call from template when SiteFactory is used

    XMLWordPrintable

Details

    Description

      Steps to reproduce

      1) Create clean eZ Platform v3.2.1 instance

      2) Enable SiteFactory

      3) Configure views:

      site_factory_group:
          design: custom
          content_view:
              full:
                  folder:
                      template: '@ezdesign/full/folder.html.twig'
                      match:
                          Identifier\ContentType: [folder] 

      4) Create templates/themes/custom/full/folder.html.twig template:

      {% extends '@ezdesign/pagelayout.html.twig' %}
      
      {% block content %}
          {{ render(controller('App\Controller\TestController::testAction')) }}
      {% endblock %} 

      5) Create App\Controller\TestController

      <?php
      
      namespace App\Controller;
      
      use Symfony\Component\HttpFoundation\Response;
      
      class TestController
      {
          public function testAction(): Response
          {
              return new Response('asd');
          }
      } 

      6) Create a new site using Site Factory. Make sure it uses the template created in step 4.

      7) Display template on the front-end (not through Page Builder!)

       

      Result

      On prod: 500 error with meaningless message. Error log says:

      [2020-11-10T21:49:37.425389+01:00] php.WARNING: Warning: Cannot bind closure to scope of internal class ReflectionProperty {"exception":"[object] (ErrorException(code: 0): Warning: Cannot bind closure to scope of internal class ReflectionProperty at /Users/kamil/www/ezplatform-v3/var/cache/prod/ContainerOMyJZE6/PublicAccessHandler_4cae68b.php:82)"} []
      [2020-11-10T21:49:37.426147+01:00] php.CRITICAL: Uncaught Error: Function name must be a string {"exception":"[object] (Error(code: 0): Function name must be a string at /Users/kamil/www/ezplatform-v3/var/cache/prod/ContainerOMyJZE6/PublicAccessHandler_4cae68b.php:83)"} []
      [2020-11-10T21:49:37.437126+01:00] request.CRITICAL: Uncaught PHP Exception Error: "Function name must be a string" at /Users/kamil/www/ezplatform-v3/var/cache/prod/ContainerOMyJZE6/PublicAccessHandler_4cae68b.php line 83 {"exception":"[object] (Error(code: 0): Function name must be a string at /Users/kamil/www/ezplatform-v3/var/cache/prod/ContainerOMyJZE6/PublicAccessHandler_4cae68b.php:83)"} [] 

      On dev: the following exception is thrown:

      An exception has been 
      thrown during the rendering of a template ("Warning: Cannot bind closure
       to scope of internal class ReflectionProperty"). 

      Full stack trace in the attachment.

      Attachments

        Activity

          People

            Unassigned Unassigned
            kamil.madejski@ibexa.co Kamil Madejski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: