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

FragmentRenderer always expects controller to be array, throws exception if object implementing __invoke() is passed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: QA Done
    • Priority: Blocker
    • Resolution: Unresolved
    • Affects Version/s: 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6
    • Fix Version/s: 3.0.0-beta4, 2.5.8
    • Component/s: Page Builder
    • Labels:
      None

      Description

      PageBuilder

      In EzSystems\EzPlatformPageBuilder\HTTP\Kernel\Fragment\DecoratedFragmentRenderer:

      private function doesReferenceBlockRender(ControllerReference $controllerReference): bool
      {
          $controllerCallable = $this->controllerResolver->getCallableFromControllerReference($controllerReference);
      
          return $controllerCallable[0] instanceof BlockController && 'renderAction' === $controllerCallable[1];
      }

      If the $controllerCallable is an object implementing __invoke() method (which is a valid callable type), the exception will be thrown on the return line (cannot use object as an array).

      Page Field type

      In EzSystems\EzPlatformPageFieldType\FragmentRenderer\BlockRenderOptionsFragmentRenderer:

      private function isBlockRenderRequest(ControllerReference $controllerReference): bool
      {
          $mockRequest = $this->mockRequest($controllerReference);
          $controller = $this->controllerResolver->getController($mockRequest);
      
          if (!\is_callable($controller)) {
              return false;
          }
      
          return $controller[0] instanceof BlockController && 'renderAction' === $controller[1];
      } 

      Same type of error as in the first example.

      In both methods, there should be additional check before the return statement - if the given callable is not an array, return false.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            hknezevic Hrvoje Knežević
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Dates

              Created:
              Updated: