![]() |
Can not extends core Exception.php - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Can not extends core Exception.php (/showthread.php?tid=51614) |
Can not extends core Exception.php - El Forum - 05-10-2012 [eluser]xander9x[/eluser] Hi, I'm trying to extend the Exception but always receive Fatal error: Call to undefined function. I tried to add function to both the system/core and application/core/MY_Exceptions.php. Both failed. Code: class MY_Exceptions extends CI_Exceptions Code: class Users extends CI_Controller Thanks! Can not extends core Exception.php - El Forum - 05-10-2012 [eluser]Aken[/eluser] foo() is a method of the MY_Exceptions class. You can't just call it like a procedural function. I'd suggest reading some more about object-orientated (OOP) PHP programming and how functions / methods / etc. work. Can not extends core Exception.php - El Forum - 05-10-2012 [eluser]xander9x[/eluser] So, how can I call show_error() anywhere in CI_Controller/CI_Model ... ? If I remove show_error() in system/core/Exceptions.php, it will not work. Can not extends core Exception.php - El Forum - 05-10-2012 [eluser]Aken[/eluser] Because show_error() by itself is a procedural function inside of system/core/Common.php, which in turn calls the show_error() method of the Exceptions class. Not 100% how it works, but as an example: Code: show_error(); // procedural Can not extends core Exception.php - El Forum - 05-13-2012 [eluser]xander9x[/eluser] Ah, great reference. Thanks a lot Aken. |