• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URI class bug in CI 1.7.0, 1.7.1

#1
[eluser]heha[/eluser]
This problem doesn't occur in CI 1.6.1 The problem is under function _fetch_uri_string() in URI class. It's happened in ORIG_PATH_INFO variable section (line 95-96).

CI 1.6.1
Code:
// No QUERY_STRING?... Maybe the ORIG_PATH_INFO variable exists?
            $path = (isset($_SERVER['ORIG_PATH_INFO'])) ? $_SERVER['ORIG_PATH_INFO'] : @getenv('ORIG_PATH_INFO');    
            if ($path != '' AND $path != '/' AND $path != "/".SELF)
            {
                $this->uri_string = $path;
                return;
            }

CI 1.7.0, 1.7.1
Code:
// No QUERY_STRING?... Maybe the ORIG_PATH_INFO variable exists?
            $path = (isset($_SERVER['ORIG_PATH_INFO'])) ? $_SERVER['ORIG_PATH_INFO'] : @getenv('ORIG_PATH_INFO');    
            if (trim($path, '/') != '' && $path != "/".SELF)
            {
                // remove path and script information so we have good URI data
                $this->uri_string = str_replace($_SERVER['SCRIPT_NAME'], '', $path);
                return;
            }

The problem is str_replace() function. My server is hostmonster with php 5.2.9 and mod_rewrite on. It fetched the value and end up with:
$_SERVER['SCRIPT_NAME'] == $path
(It's value is "controller/method" only on both variable.)
So, "$this->uri_string" receive blank result like it can't be get URI segment.

The solution is I must remove str_replace out and set that line to the same with CI 1.6.1 to be able to call URL as normal.

There are some strange points. If I type URL like "myserver.com/index.php/controller/method", then CI will catch data with $_SERVER['PATH_INFO']. If I type URL like "myserver.com/controller/method", then CI will catch data with $_SERVER['ORIG_PATH_INFO']. I don't know why it has to access different variable just because I type index.php and don't type index.php. It's the same server with just different URL. How did this thing happen?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.