Reputation: 11553
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?
Upvotes: 0
Views: 97
Reputation: 12679
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");
Upvotes: 1
Reputation: 8461
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.
Upvotes: 0
Reputation: 47604
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.
Upvotes: 1