Grabbing PHP Warning and Errors
Posted: Mon Jun 08, 2009 5:50 pm
Hi,
I'm looking at creating a small script that grabs the contents of a URI (using file_get_contents) and scans it for PHP errors or warnings.
I am fine with grabbing the page and scanning it for strings or regular expressions, the problem is what regular expression to use. As you're probably aware there are a few formats for the error messages that (default) PHP produces, such as when you miss a brace or bracket, this is different to if fopen() fails.
Has anyone got a list of all of the error formats PHP could produce? Or even better some regexp to match it? I was thinking of just searching for '[function.*]*on line:*' as I think that would cover most of it, but maybe it's too generic? Thoughts?
I'm looking at creating a small script that grabs the contents of a URI (using file_get_contents) and scans it for PHP errors or warnings.
I am fine with grabbing the page and scanning it for strings or regular expressions, the problem is what regular expression to use. As you're probably aware there are a few formats for the error messages that (default) PHP produces, such as when you miss a brace or bracket, this is different to if fopen() fails.
Has anyone got a list of all of the error formats PHP could produce? Or even better some regexp to match it? I was thinking of just searching for '[function.*]*on line:*' as I think that would cover most of it, but maybe it's too generic? Thoughts?