php - Codeigniter + Whoops -
i'm trying setup whoops on codeigniter 3 application.
i installed whoops composer , calling :
use whoops\handler\prettypagehandler; if (environment == 'development') { $whoops = new \whoops\run; $whoops->pushhandler(new whoops\handler\prettypagehandler()); $whoops->register(); $handler = new prettypagehandler; $handler->seteditor('sublime'); }
it works warnings, notices , deprecated errors, not fatal errors.
codeigniter seems handle them before whoops. there way modify behavior?
i got working moving "whoops run" in index.php file, right after defining development environment , error reporting settings (around line 70 in ci index.php file) :
/* *--------------------------------------------------------------- * error reporting *--------------------------------------------------------------- * * different environments require different levels of error reporting. * default development show errors testing , live hide them. * 2017-08-21: adding whoops profiler */ use whoops\handler\prettypagehandler; switch (environment) { case 'development': case 'staging': error_reporting(-1); ini_set('display_errors', 1); error_reporting(e_all ^ e_warning ^ e_user_warning ^ e_notice ^ e_deprecated ); $whoops = new \whoops\run; $whoops->pushhandler(new whoops\handler\prettypagehandler()); $whoops->register(); break; case 'testing': case 'production': ini_set('display_errors', 0); if (version_compare(php_version, '5.3', '>=')) { error_reporting(e_all & ~e_notice & ~e_deprecated & ~e_strict & ~e_user_notice & ~e_user_deprecated); } else { error_reporting(e_all & ~e_notice & ~e_strict & ~e_user_notice); } break; default: header('http/1.1 503 service unavailable.', true, 503); echo 'the application environment not set correctly.'; exit(1); // exit_error }
a comment in this github whoops issue tipped me off!
Comments
Post a Comment