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

Missing use statement in PageService.php

    XMLWordPrintable

    Details

      Description

      A use statement is missing in following file: vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishCoreBundle/FieldType/Page/PageService.php

      try {
          $contentInfoObjects[] = $this->contentService->loadContentInfo($item->contentId);
      } catch (UnauthorizedException $e) {
           // If unauthorized, disregard block as "valid" and continue loading other blocks.
      }
      

      The following statement needs to be added to make the catch work:

      use eZ\Publish\Core\Base\Exceptions\UnauthorizedException;
      

      Step to reproduce:

      1. Create the following content structure:

      Home
      	Tests (location_id: 122, object_id: 120)
      		Article 1 (location_id: 123, object_id: 121)
      

      2. Create a new section ("Test Section") and assign it to /Home/Tests/;
      3. Edit ezpublish_legacy/settings/override/block.ini.append.php and create a standard manual block:

      [General]
      AllowedTypes[]=Manual3Items
      
      [Manual3Items]
      Name=3 Column News
      NumberOfValidItems=3
      NumberOfArchivedItems=5
      ManualAddingOfItems=enabled
      ViewList[]=3_items1
      ViewName[3_items1]=3 articles in one column 
      

      4. Edit the existing "Home" node, which is a "Landing Page" ContentType;
      5. Add a new custom block of type "3 Column News" to an existing zone e.g. left;
      6. Add an existing content to the new custom block. In this test, used /Getting Started/Resources/eZ Publish Tutorials, which is an article that is installed with demo content. It belongs to the "standard" section, and as such, is visible to anonymous users with standard roles and policies;
      7. Also add "/Home/Tests/Article 1" to the new custom block;
      8. Publish;
      9. Try to access the above content on the frontend as an anonymous user.

      Results:

      • In "Prod" environment: the "3 Column News" section was not displayed at all, and also no errors were generated;
      • In "Dev" environment: got this exception:
      An exception has been thrown during the rendering of a template ("User does not have access to 'read' 'content' with: contentId '121'").
      500 Internal Server Error - Twig_Error_Runtime
      1 linked Exception: UnauthorizedException ยป 
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              nuno.oliveira-obsolete@ez.no Nuno Oliveira (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: