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


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()

$url = trim($this->security->xss_clean($this->uri->segment(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.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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