I want to build a regex that matches PHP-style error messages in HTML source code.
Does anybody know of one that exists or how I can create a list of possible PHP error outputs?
I want to build a regex that matches PHP-style error messages in HTML source code.
Does anybody know of one that exists or how I can create a list of possible PHP error outputs?
Take a look at the PHP source code, there should be a function to wrap errors and try to guess the convention used for all errors, warning, notices messages.
You can see a list of PHP's Predefined Constants.
Every error/warning/notice will fall into one of these categories, however there are likely hundreds if not thousands of possible messages which PHP can throw.
Depending on what you're actually trying to accomplish (you weren't very specific), I would instead recommend using set_error_handler
.
function myErrorHandler($errno, $errstr, $errfile, $errline) {
// handle and log the error appropriately
}
set_error_handler("myErrorHandler");