I'm in the process of building an admin framework where PHP class files are dynamically loaded and run when requested, with lots of use of class_exists(), method_exists(), call_user_func() to make sure the class itself conforms to the overall design.
The thing I've been banging my head on a brick wall with is finding a way to gracefully continue on from using an include() or include_once() when the class file (or script for that matter) is broken (i.e. someone else is editing it or there is a syntax error, etc). I've been through most of the php.net pages and the comments that suggest workarounds on this very issue but they don't work either. I've tried the whole include() within a try {}, an if/else on the include while error_reporting turned is off... I was going to try and do a get_file_contents() and run that through an eval or start playing with the set_error_handler but I don't think they'll work.
My only other thought is to try and validate the PHP file before loading, either way does anyone here know of a simple way of solving this? It would be brilliant if there was a function that would tell you if a php file was valid before loading, or give you a proper return on that failed include.