Grabbing PHP Warning and Errors

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mikemike
Forum Contributor
Posts: 355
Joined: Sun May 24, 2009 5:37 pm
Location: Chester, UK

Grabbing PHP Warning and Errors

Post by mikemike »

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?
Post Reply