Welcome Guest, Not a member yet? Register   Sign In
URI Library ignoring empty values in query string
#1

[eluser]tdktank59[/eluser]
so i have a query that looks like this

Quote:http://localhost/problems/query/sEcho/2/...extract/-1

The expected result would be
Quote:sEcho = 2
iColumns = 6
sColumns =
iDisplayStart = 0
iDisplayLength = 10
sSearch =
bEscapeRegex = true
sSearch_0 =
etc....

However it is ignoring the // and treating them as a /
giving me this
Quote:sEcho = 2
iColumns = 6
sColumns = iDisplayStart
0 = iDisplayLength
10 = sSearch
bEscapeRegex = true
sSearch_0 =

I was able to fix it back in 1.7.1 for myself by modifying the core.
However in the SVN release 1.7.2 I can't figure out how to override it to allow the null values. I also can't modify the script sending these values since it relies on some of them being empty. And I can't stop the empty values from being passed since I did not develop the library sending the results.

Any ideas on how to bypass this?

ps: CI Devs, I find this to be very annoying that the URI library feels it can just get rid of /'s as it sees fit...

EDIT:
After some more debugging I found it is in the $_SERVER['PATH_INFO'] variable...
#2

[eluser]Dam1an[/eluser]
A quick and dirty way could be to get the $_SERVER['REQUEST_URI'] variable, and explode it on /
Then all the even values (starting at 0, remember) would be the keys and the odds would be the values

(Note: you may need to shift the array a bit if you don't have this in the web root)

Edit: Damn, his edit beat me, although you now have the choice of PATH_INFO or REQUEST_URI Smile
#3

[eluser]tdktank59[/eluser]
Doh...

I forgot about that.

So heres the way I got it to work...

Modify:
Line 76:
Code:
$path = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO');
change to
Code:
$path = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : @getenv('PATH_INFO');


Line: 236-239
Code:
if ($val != '')
{
    $this->segments[] = $val;
}
change to:
Code:
$this->segments[] = $val;

This made it work for me!




Theme © iAndrew 2016 - Forum software by © MyBB