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

Moved URLs and URLs with incorrect casing produce 2 full page loads

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Medium Medium
    • Resolution: Fixed
    • Affects Version/s: 4.2.0, 4.3.0, 4.4.0, 4.5.0alpha, 4.5.0beta1, 4.5.0beta2
    • Fix Version/s: Customer request
    • Component/s: Misc
    • Labels:
      None
    • Environment:

      eZ Publish 4.2 - 4.6

      Description

      As an example, if the proper node URL is: http://www.example.com/World and a visitor accesses http://www.example.com/world, the end result is that http://www.example.com/World is generated and shown. However, the full view is actually executed twice: the first time unnecessarily in the background. To be clear: this is automatic redirect behavior native to eZ Publish, NOT any redirect behavior specified in templates or custom views.

      Confirmed on eZ Publish 4.2, 4.4 and 4.5. We have verified this by adding some logging at the bottom of the pagelayout.tpl file and noting that the log occurs twice on such redirect pages. No template processing should take place on the "world" load; it should only execute on the "World" load.

      This is a problem for 3 reasons:
      1. Inefficient performance by loading all templates twice
      2. Unpredictable cache block behavior, noted when cache blocks rely on ezpagedata() and/or persistent variable information, which is incorrectly generated in the "world" load.
      3. Any important server-side code that should only be executed once on a page load is executed twice.

      The diff below of a working but likely not completely efficient fix is on the community version of eZP 4.4.

      Index: index.php
      ===================================================================
      --- index.php
      +++ index.php
      @@ -690,6 +690,8 @@
                   if ( $objectHasMovedError == true )
                   {
                       $moduleResult = $module->handleError( eZError::KERNEL_MOVED, 'kernel', array( 'new_location' => $objectHasMovedURI ) );
      +                $module->setRedirectURI( $objectHasMovedURI );
      +                $module->setExitStatus( eZModule::STATUS_REDIRECT );
                   }
                   else if ( !$moduleAccessAllowed )
                   {
      

      Steps to reproduce
      • Add for example some bad syntax at the end of pagelayout.tpl, which will produce an error or warning
      • Make sure that logging to file is enabled
      • Create a folder name "World" (upper case)
      • Access "/world" (lower case), get redirected to "/World"
      • Note that the template error is logged twice; the pagelayout has been loaded twice.

        Issue Links

          Activity

          Hide
          Damien Pobel (eZ) added a comment -

          Fixed in ezpublish master (4.6alpha1) : https://github.com/ezsystems/ezpublish/commit/6086dd7

          Show
          Damien Pobel (eZ) added a comment - Fixed in ezpublish master (4.6alpha1) : https://github.com/ezsystems/ezpublish/commit/6086dd7
          Hide
          Geir Arne Waaler added a comment -

          The issue is fixed. I hence move it from Code Review to Closed.

          Geir Arne Waaler
          eZ Documentation

          Show
          Geir Arne Waaler added a comment - The issue is fixed. I hence move it from Code Review to Closed. Geir Arne Waaler eZ Documentation

            People

            • Assignee:
              Damien Pobel (eZ)
              Reporter:
              (inactive) Gunnstein Lye
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: