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

In non Virtual Host mode url is encoded incorrectly

    XMLWordPrintable

Details

    Description

      If an user goes to some url (view) with outdated nice url (name)
      like 'http://host/eng/news' but now 'news' is 'News'
      so in that case ezp will return the error #4 and will redirect to correct url 'http://host/eng/News'
      (all this steps will be invisible for the users) - the user will just see correct URL in his browser

      but In non Virtual Host indexDir (eZSys::indexDir()) can contain a question mark '?'
      see eZSys:init()

              if ( $isCGI and !$force_VirtualHost )
              {
                  $index .= '?';
              }
      

      but due to error/view.php

      $location = eZSys::indexDir() . "/" . $extraErrorParameters['new_location'];
      ...
      $location = eZURI::encodeIRI( $location ); // Make sure it is encoded to IRI format
      

      returned uri will be encoded so, question mark will be like %3F
      ezp will not understand this url at all

      proposed fix:

      Index: view.php 
      =================================================================== 
      --- view.php    (revision 20716) 
      +++ view.php    (working copy) 
      @@ -99,6 +97,11 @@ 
                               header( $_SERVER['SERVER_PROTOCOL'] .  " 301 Moved Permanently" ); 
                               header( "Status: 301 Moved Permanently" ); 
                               $location = eZURI::encodeIRI( $location ); // Make sure it is encoded to IRI format 
      +                        $isCGI = ( substr( php_sapi_name(), 0, 3 ) == 'cgi' ); 
      +                        if ( $isCGI ) 
      +                        { 
      +                            $location = str_replace( '%3F', '?', $location ); 
      +                        } 
                               header( "Location: " . $location ); 
                           } 
                       } 
      
      Steps to reproduce

      1. Install ezp in nVH mode
      2. Create an object with name 'news'
      3. Republished the object with name 'News'
      4. Try to view this object by old nice url

      Attachments

        Activity

          People

            cyberwolf cyberwolf
            vd vd
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: