pamelanye / libstats

Automatically exported from code.google.com/p/libstats
GNU General Public License v2.0
1 stars 0 forks source link

Major pitfall in getOperation function #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The getOperation function is supposed to get just the filename of the requested 
page. It does this by essentially matching whatever string is between the last 
"/" and ".do" in the REQUEST_URI variable.  However, if there is ever a "/" in 
the query part of the URI, it will not return the requested page filename (and 
subsequently go to error page). This normally isn't a problem unless doing CSV 
export with date criteria, I've noticed, as the dates contain backslashes.

Two possible fixes:
-Pass in $_SERVER["SCRIPT_NAME"] to getOperation instead to remove the query 
portion of the URI.

-Use this regex or something similar to extract the filename: 
if (preg_match('%/([^//]+?.do)%', $uri, $groups)) {
    $operation = $groups[1];
}

Original issue reported on code.google.com by greenwoo...@gmail.com on 10 Jun 2010 at 7:41

GoogleCodeExporter commented 8 years ago
This roughly does #2 as mentioned above.

Original comment by mmccol...@gmail.com on 7 Apr 2011 at 7:02

Attachments:

GoogleCodeExporter commented 8 years ago
Apologies, my previous patch introduces a syntax error into 
ControllerFunctions.php. Here is a corrected patch.

Original comment by mmccol...@gmail.com on 13 Apr 2011 at 5:50

Attachments: