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

updateviewcount.php URL parsing

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Medium Medium
    • None
    • 4.0.3
    • Cronjobs
    • None

    Description

      In working with updateviewcount.php in eZ Publish 4.0.2 I found it wouldn't parse my apache error logs correctly due to the logic used on line 161 and 162.

      $urlArray = split( "/", $url );
      $firstElement = $urlArray[0];
      

      The above splits the requested URL and returns a blank value as the first array value if the resulting URL starts with a forward slash.

      In the case of the log file I was parsing it was necessary to make the following change

      $urlArray = split( "/", $url, 2 );
      $firstElement = $urlArray[1];
      

      This ensured that the first slash was removed and the resulting URL was passed to eZURLAliasML::fetchNodeIDByPath.

      I think the logic is screwy and certainly isn't going to work in all cases, split shouldn't really be used to trim the leading slash and it probably isn't a required step at all. The existing code however seems flawed as it splits the URL on forward slashes and only passes the first value onto eZURLAliasML::fetchNodeIDByPath. This won't work as it will only register visits to top level nodes and not their children as these paths are stripped and not passed through to the function.

      Attachments

        Activity

          People

            unknown unknown
            ecactive ecactive
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: