Welcome Guest, Not a member yet? Register   Sign In
CI 1.6 >> Problem with URI library not picking up first segment
#1

[eluser]stevepaperjam[/eluser]
I've had a good look round and no-one seems to have had this problem yet, so it could be something freaky at my end, but here goes.

I've got my CI 1.54 project set up so that the index.php is rewritten out, so...
Code:
/home
redirects to..
Code:
/index.php/home
...which is then routed internally to a controller in shop/home.

On upgrading to 1.6 I'm getting a 404 when issuing /home, although /index.php/home works. On inspection it seems that libraries/URI.php wasn't quite picking up the first segment.

Here's the original code from line 73 or so of URI.php, in the method _fetch_uri_string():
Code:
$key = array_keys($_GET);
$index = current($key);
$this->uri_string = $_GET[$index];                
return;
I changed the third line here to read:
Code:
$this->uri_string = $index;
... and now it works. I'm using the same htaccess for stripping out the index.php across both versions, by the way. Could someone verify this bug and fix?

BTW I'm using MAMP1.7 on a Macbook, and the issue occurred in both PHP4.47 and PHP 5.2.3.
#2

[eluser]Seppo[/eluser]
I have the same problem on Windows XP running PHP 4.3.9, 4.4.7, 5..0.0, 5.1.6 and 5.2.5. To test I just use a index.php?controller/method
#3

[eluser]stevepaperjam[/eluser]
Great, thanks Seppo. Did the suggested fix work?
#4

[eluser]Seppo[/eluser]
Yeap.
I suggest you to report it in the bug tracker
#5

[eluser]stevepaperjam[/eluser]
Cheers Seppo, will do.

Now logged as bug 3321
#6

[eluser]wiredesignz[/eluser]
Same issue with CI 1.6.0 here too (except I thought it was my routes setup). Thanks for this.
#7

[eluser]Derek Jones[/eluser]
Steve, what is your .htaccess that you are using. With that URL, I don't even see how that code is being triggered for you, as you aren't using query strings.
#8

[eluser]stevepaperjam[/eluser]
Derek - the latest updates to SVN seem to have fixed it, thanks.
#9

[eluser]Derek Jones[/eluser]
Cool, yes, that bug was confirmed and fixed - but to satiate my curiosity, I'd still like to know how your URLs are being formed. What you show in your original post would not set any GET data at all.
#10

[eluser]stevepaperjam[/eluser]
...sorry, I left out the domain, just a local dev thing. I don't own shop.co.uk...

Code:
http://dev.shop.co.uk/home

redirects to:

Code:
http://dev.shop.co.uk/index.php/home




Theme © iAndrew 2016 - Forum software by © MyBB