Disable fancy errors in CakePHP
👉 Whoa! Please note that this post is 15 years old. The views expressed within might have become outdated.
Here at work we often go crazy because of CakePHP's "helpful" displaying of error messages.
They are littered with HTML and, even worse, Javascript and provide an often superfluous stack trace, which makes it harder to read the actual error message.
If you just want readable, plain text error messages in your projects, add the following to /app/config/bootstrap.php
:
function displayErrorWithoutCrap() {
// returning false here means the internal PHP error handler will take over again and display a neat, clean error
return false;
}
set_error_handler('displayErrorWithoutCrap');
And if the Cake guys could make this configurable in their next release, that would just be awesome.