• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Codeigniter 3.0 RC issue with not calling __construct when no method matching

#1
Hi,

We have recently updated to Codeigniter 3.0 RC and got one issue.

We have one controller which have only constructor function. It check uri segment and redirect to another url. It was working fine in last version but i have checked that now it not calling constructor if matching function not present, it directly look for function in controller first if present then call the controller constructor.

I have used alternative to make a function in controller and then add a route in route.config. Can you please help why earlier approach not working.

class Shorturl extends CI_Controller {

public function __construct()
{
parent::__construct();

$url = trim($this->security->xss_clean($this->uri->segment(2)));
redirect($url,'location',301);
}
}
Reply

#2
(02-02-2015, 10:41 AM)sandeepmittal88 Wrote: ...
why earlier approach not working
...

Because it's a wrong approach. No instantiated class should ever contain only a constructor.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.