CodeIgniter Forums
What will be if ur models extends MY_Controller? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 2.x (https://forum.codeigniter.com/forumdisplay.php?fid=18)
+--- Thread: What will be if ur models extends MY_Controller? (/showthread.php?tid=1023)



What will be if ur models extends MY_Controller? - dimawebmaker - 02-06-2015

Few days ago I was make some changes in my code before going to sleep.
By mistake I make this code: models extends MY_Controller.

MY_Controller have standart code:

class MY_Controller extends CI_Controller {
public data = array();
public function __construct()
{
parent::__construct();
$this->data['blabla'] = blabla;
}
}

I don't have xdebug, and when I was run php -S localhost:2222 (php version 5.5) I saw only one error "segmentation fault". If u try to search what this mean, u will find thousands answers how fix it. Some peoples recomend check memory or remove php-mysql.
xdebug don't help me fix errors, and I was researched all last modifed files to find my mistake.


RE: What will be if ur models extends MY_Controller? - includebeer - 02-06-2015

Don't waste your time trying to understand why it doesn't work and just fix your code. A model is not supposed to extend a controller. Also, I doubt the segmentation fault error is caused by your code. Because this error means PHP has crashed. It may be a bug in PHP itself or something is wrong with your server.


RE: What will be if ur models extends MY_Controller? - dimawebmaker - 02-06-2015

(02-06-2015, 05:06 PM)includebeer Wrote: Don't waste your time trying to understand why it doesn't work and just fix your code. A model is not supposed to extend a controller. Also, I doubt the segmentation fault error is caused by your code. Because this error means PHP has crashed. It may be a bug in PHP itself or something is wrong with your server.

Sure u right. I just post this message for peoples, that like me have a bad luck. Smile