Catch a fatal exception and continue
I know, that by its very definition, a fatal exception is supposed to kill the execution, and should not be suppressed, but here's the issue. I'm running a script that scrapes, parses and stores in a DB about 10,000 pages. This takes a couple of hours, and in rare cases (1 in 1000) a page fails parsing and throws a fatal exception. Currently, I'm doing this: for ($i=0;$i<$count;$i++) { $classObject = $classObjects[$i]; echo $i . " : " . memory_get_usage(true) . "\n"; $classDOM = $scraper->scrapeClassInfo($classObject,$termMap,$subjectMap); $class = $parser->parseClassInfo($classDOM);