Welcome Guest, Not a member yet? Register   Sign In
$this->uri->uri_to_assoc() Replaces Period "." (dot) With An Underscore "_"
#1

[eluser]morehawes[/eluser]
Hi all, this has got me truely stumped so I am wondering if anyone has any ideas! Getting URI data using uri_to_assoc is replacing "." (period) with "_" (underscore). For example this basic controller :

Code:
<?php class Test extends Controller {
    function get_data() {
        echo '<pre>';
        print_r($this->uri->uri_to_assoc());
        echo '</pre>';
    }
}

When given the URL "http://www.myurl.com/test/get_data/usern...hawes.test" outputs this :

Code:
Array
(
    [username] => morehawes_test
)

I have also checked my config to ensure periods are allowed :

Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';

I would really really appreciate it if anyone could help with this Smile

Many thanks!
#2

[eluser]danmontgomery[/eluser]
This is PHP functionality, it happens well before the uri gets to codeigniter.

http://us.php.net/variables.external
[quote]The experienced may note that the actual variable names sent by the browser contains a period rather than an underscore, but PHP converts the period to an underscore automatically.
#3

[eluser]morehawes[/eluser]
Hi noctrum, thanks for your swift reply. This is a big help - I was not aware of this behaviour. Infact on my localhost this is not happening at all, only on my hosting. Do you think this is being caused by register_globals being on? (off in my locahost and on in my hosting)

This is causing a big problem with my application so if this is the case I may try and get my hosting company to change this (using php_flag register_globals off in my htaccess file doesn't seem to work)
#4

[eluser]morehawes[/eluser]
Hi again, just to let you know that I have fixed the problem by figuring out a work-around. Thanks again for your help Smile




Theme © iAndrew 2016 - Forum software by © MyBB