calling controller constructor via url ... |
[eluser]druid100[/eluser]
hi, i just noticed that it is possible to call the constructor of a controller via url. i.e. if there is is a controller called Users you could navigate to http://localhost/users/User ... and get a blank page. i assumed calling this should give a page 404 not found. any thoughts? cheers.
[eluser]Michael Wales[/eluser]
Use PHP5. In all seriousness, you could always use Routes to direct that URL to the index method of the controller.
[eluser]druid100[/eluser]
[quote author="Michael Wales" date="1204751066"]Use PHP5. In all seriousness, you could always use Routes to direct that URL to the index method of the controller.[/quote] ... i'm pretty sure i do use php5 of course i could add routes for all controllers, but however i assumed ci would disallow calling the controller constructor exernally - it aussume nobody wants his constructors called in such a way. most of the time it should not cause problems but besides a potential bad user experience it may cause problems. i hoped that there is some kind of config setting to disallow this ...
[eluser]Negligence[/eluser]
Use __construct() instead of the class name for the constructor.
[eluser]Michael Wales[/eluser]
Quote:Use __construct() instead of the class name for the constructor. That's what I was referring to, in using PHP5.
[eluser]Seppo[/eluser]
I think this may be consider as a bug... I think CI should not allow calling constructors... Something like this? Code: if ( ! class_exists($class) |
Welcome Guest, Not a member yet? Register Sign In |