Welcome Guest, Not a member yet? Register   Sign In
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




Theme © iAndrew 2016 - Forum software by © MyBB