URI routing causing incorrect function arguments. - 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: URI routing causing incorrect function arguments. (/showthread.php?tid=13066) |
URI routing causing incorrect function arguments. - El Forum - 11-10-2008 [eluser]Unknown[/eluser] I have developed quite an extensive addon to the CodeIgniter codebase, and have come across quite a strange bug. There's quite a lot to get to explain the bug... Firstly, I have a settings file in which I can specify 'virtual folders' within my application, which I include in the index.php file (in the root): Code: $settings = array( My intention is to use this to route '/admin/users/add' to 'users/admin_dashboard'. I then set up the routes.php file to look something like this: Code: $all = "([\w-]+)"; The problem is that when I set up a controller method that uses the automatic url to argument conversion (based on segmental positioning): Code: function admin_view($bob = 1, $page = 2) { If I specify the first argument as an integer value (ex. '/testapp/admin/adverttypes/view/5') then $bob reflects a value of 5, $page reflects a value of 2. If I omit the integer value (ex. '/testapp/admin/adverttypes/view/') then $bob reflects a value of 1, $page reflects a value of 5. So, in plain terms, when I use this method of custom routing (which should render the routed segments in the same way as any other method) the arguments array differs when uri values are omitted. Curious... |