CodeIgniter Forums
CI 1.6 >> Problem with URI library not picking up first segment - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CI 1.6 >> Problem with URI library not picking up first segment (/showthread.php?tid=5560)

Pages: 1 2


CI 1.6 >> Problem with URI library not picking up first segment - El Forum - 01-26-2008

[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.


CI 1.6 >> Problem with URI library not picking up first segment - El Forum - 01-26-2008

[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


CI 1.6 >> Problem with URI library not picking up first segment - El Forum - 01-26-2008

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


CI 1.6 >> Problem with URI library not picking up first segment - El Forum - 01-26-2008

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


CI 1.6 >> Problem with URI library not picking up first segment - El Forum - 01-26-2008

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

Now logged as bug 3321


CI 1.6 >> Problem with URI library not picking up first segment - El Forum - 01-26-2008

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


CI 1.6 >> Problem with URI library not picking up first segment - El Forum - 01-29-2008

[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.


CI 1.6 >> Problem with URI library not picking up first segment - El Forum - 01-30-2008

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


CI 1.6 >> Problem with URI library not picking up first segment - El Forum - 01-30-2008

[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.


CI 1.6 >> Problem with URI library not picking up first segment - El Forum - 01-30-2008

[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