Welcome Guest, Not a member yet? Register   Sign In
URL bug - A segment of '0' returns false?
#1

[eluser]Rokkitt[/eluser]
Seriously. This is causing me all kind of headaches. Have the same code locally as I do on my server. Both are running PHP 5.4.

config/routes.php

Code:
$route['default_controller'] = "frontend/run";
$route['send_contact/(:num)'] = "frontend/send_contact/$1";
$route['404_override'] = 'frontend/run';

controllers/frontend.php > run()

Code:
public function run()
{
// Get Page
var_dump($this->uri->segment(1)); exit;
}

Tests

mysite.com/blah
// Returns: string(4) "blah"

mysite.com/1
// Returns: string(1) "1"

On my server.. broken..

mysite.com/0
// Returns: bool(false)

Locally.. works..

mysite.com/0
// Returns: string(0) "0"

Can anyone else recreate this? Any idea why this is happening?
#2

[eluser]Rokkitt[/eluser]
Been plugging away at this for 2 hours.. surprising what posting can shake loose.

Server required the following config setting.

<code>$config['uri_protocol'] = 'REQUEST_URI';</code>

I don't know if this would be classed as a CI error. Rather annoying though. Use a URI of 0 to check that the uri_protocol is properly configured I guess.





Theme © iAndrew 2016 - Forum software by © MyBB