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

ConfigResolver default scope is not updated when SiteAccess is matched

    Details

      Description

      When booting the ConfigResolver, it receives the current SiteAccess in order to resolve dynamic settings. setSiteAccess() method is called, which also define the defaultScope, which is by default the SiteAccess name.
      This default scope can change for example when performing a preview (config scope change).

      However, when compiling, cache warmup may mess this up, especially when Twig extensions are involved, as cache warmup process occurs before SiteAccess matching. Thus Twig extensions which rely on dynamic settings and/or ConfigResolver can be biased, since the wrong default scope is used.

      Using ezplatform-design-engine, an exception saying that it can't find a template using @standard namespace can occur. This is a consequence of what was explained above.

      I know this is a brain-f..k thing, and another SiteAcces hell...

        Issue Links

          Activity

          Show
          Jérôme Vieilledent added a comment - PR: https://github.com/ezsystems/ezpublish-kernel/pull/2028
          Hide
          Rui Silva (Inactive) added a comment -

          Jérôme Vieilledent, we at QA have tried to reproduce this issue by taking the following steps, as they appear, to me, to be according to the description provided on the issue:

          1. I have a bundle with a Twig extension filter:

          public function ezp27510Filter( $arg1, $scope = "swiss_knife" )
          {
          	$parameter = $this->getResolvedParameter( "doThis", $scope );
          	return "'doThis' parameter value: " . $parameter;
          }
          

          that simply returns a resolved parameter via siteaccess matching.

          2. I am using this Twig extension filter on a simple template I access via a simple controller.

          3. I have defined two parameters defined (actually one, via two siteaccess configs):

          parameters:
              swiss_knife.default.doThis: "and that."
              swiss_knife.site.doThis: "Just fo this."
          

          4.When I access my route:
          http://ezpmaster.rui/ezp27510
          I am expecting to see my rendered template, which is simply the following:

          {{ "some arg" | ezp27510( "swiss_knife" ) }}
          

          show the following:

          'doThis' parameter value: and that.
          

          since it does not match the siteaccess.
          However, if I only have "swiss_knife.default.doThis" defined, I get:
          'doThis' parameter value: and that.
          if I have both defined ("swiss_knife.default.doThis" and "swiss_knife.site.doThis"), I get:
          'doThis' parameter value: Just fo this.
          which seems to be the correct expected behaviour.

          Do you have any idea on how to better reproduce this?
          Thanks.

          Show
          Rui Silva (Inactive) added a comment - Jérôme Vieilledent , we at QA have tried to reproduce this issue by taking the following steps, as they appear, to me, to be according to the description provided on the issue: 1. I have a bundle with a Twig extension filter: public function ezp27510Filter( $arg1, $scope = "swiss_knife" ) { $parameter = $this->getResolvedParameter( "doThis", $scope ); return "'doThis' parameter value: " . $parameter; } that simply returns a resolved parameter via siteaccess matching. 2. I am using this Twig extension filter on a simple template I access via a simple controller. 3. I have defined two parameters defined (actually one, via two siteaccess configs): parameters: swiss_knife.default.doThis: "and that." swiss_knife.site.doThis: "Just fo this." 4.When I access my route: http://ezpmaster.rui/ezp27510 I am expecting to see my rendered template, which is simply the following: {{ "some arg" | ezp27510( "swiss_knife" ) }} show the following: 'doThis' parameter value: and that. since it does not match the siteaccess. However, if I only have "swiss_knife.default.doThis" defined, I get: 'doThis' parameter value: and that. if I have both defined ("swiss_knife.default.doThis" and "swiss_knife.site.doThis"), I get: 'doThis' parameter value: Just fo this. which seems to be the correct expected behaviour. Do you have any idea on how to better reproduce this? Thanks.
          Hide
          Rui Silva (Inactive) added a comment -

          Sanity testing was executed on this jira since no scenario to reproduce this was ensured, following the steps referred previously.
          Tested and approved by QA for master.

          Show
          Rui Silva (Inactive) added a comment - Sanity testing was executed on this jira since no scenario to reproduce this was ensured, following the steps referred previously. Tested and approved by QA for master.

            People

            • Assignee:
              Unassigned
              Reporter:
              Jérôme Vieilledent
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: