![]() |
Missing arguments from the controllers when auto load 'uri' class in autoload.php - 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: Missing arguments from the controllers when auto load 'uri' class in autoload.php (/showthread.php?tid=33062) Pages:
1
2
|
Missing arguments from the controllers when auto load 'uri' class in autoload.php - El Forum - 08-13-2010 [eluser]feload[/eluser] Hello, First, i'm not sure if this is a bug. I know that the 'URI' class is included automatically and is not necessary to autoload. Don't ask. ![]() When i configure this class to be autoloaded in the autoload.php... Code: $autoload['libraries'] = array('syauth','uri'); Edit: And try to send parameters to my controller via URL i receive a message like this: Quote:Message: Missing argument 1 for Controlador::read() So there you have it. I hope this contribution can help some way. Thanks for read. Missing arguments from the controllers when auto load 'uri' class in autoload.php - El Forum - 08-14-2010 [eluser]WanWizard[/eluser] The URI class doesn't have a method called read(). Aure you sure the URI class is causing this? Missing arguments from the controllers when auto load 'uri' class in autoload.php - El Forum - 08-14-2010 [eluser]feload[/eluser] Sorry, i forgot to specify. I'm sending parameters to my controler via URL. Quote:http://local-ci/backend/controlador/read/(some-parameter) And i'm not sure if the problem is the URI class, but at this time, is the only one class that seems to be the problem when autoload. Missing arguments from the controllers when auto load 'uri' class in autoload.php - El Forum - 08-14-2010 [eluser]WanWizard[/eluser] Assuming controlador is a controller that contains the read method, that's where the error is. You have probably defined it as Code: function read ( $var ) Missing arguments from the controllers when auto load 'uri' class in autoload.php - El Forum - 08-14-2010 [eluser]feload[/eluser] Yep. The problem is that i'm passing that parameter via URL!. Quote:http://local-ci/backend/controlador/read/45 Where '45' is the parameter passed ($var in your code example). So, it's suposed to be working. But it doesn't. This only works when i remove 'URI' from autoload var in autoload.php. I hope this is clear now. Missing arguments from the controllers when auto load 'uri' class in autoload.php - El Forum - 08-14-2010 [eluser]WanWizard[/eluser] Just tried that here using a fresh CI installation. Doesn't matter if URI is autoloaded or not, the URI segments are passed to the method without problems. Missing arguments from the controllers when auto load 'uri' class in autoload.php - El Forum - 08-15-2010 [eluser]feload[/eluser] Please try to move your controller to a sub folder, example: Quote:http://local-ci/subfolder/controlador/read/parameter Tell me if it works. Missing arguments from the controllers when auto load 'uri' class in autoload.php - El Forum - 08-15-2010 [eluser]WanWizard[/eluser] Created a sub folder called "test", and copied the welcome controller to it. Then I added a test method: Code: function test($var1 = '', $var2 = '') When I then request this URL Quote:http://test.catwoman.exite.local/test/welcome/test/23/45I get as result Code: Hello World No problem. Missing arguments from the controllers when auto load 'uri' class in autoload.php - El Forum - 08-15-2010 [eluser]feload[/eluser] Oh sorry. I thught that URI was the problem. I'll try to reproduce the issue in a clean CI installation. Note: The "issue" was detected on version 1.7.2 from web site download. Missing arguments from the controllers when auto load 'uri' class in autoload.php - El Forum - 08-16-2010 [eluser]minerbog[/eluser] [quote author="feloadz" date="1281825406"]Yep. The problem is that i'm passing that parameter via URL!. Quote:http://local-ci/backend/controlador/read/45 Where '45' is the parameter passed ($var in your code example). So, it's suposed to be working. But it doesn't. This only works when i remove 'URI' from autoload var in autoload.php. I hope this is clear now.[/quote] As you quoted earlier in this same post, the URI class is loaded by default. It shouldn't even be in the autoload.php file! |