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

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • Customer request
    • 4.2.0, 4.3.0, 4.4.0, 4.5.0alpha, 4.5.0beta1, 4.5.0beta2
    • Misc
    • None
    • 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.

      Attachments

        Activity

          People

            dp@ez.no dp@ez.no
            gl gl
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: