I load dynamically PHP class files with autoload. And those files could be missing or corrupted by some reason.
Autoload will successfully report missing files so application logic could handle that. But if those files are corrupted, then the whole processing halts with blank screen for the user and "PHP Parse error: syntax error" in error log.
Is it possible to check syntax of PHP file from PHP code?
I've looked here: http://us.php.net/manual/en/function.php-check-syntax.php - it's deprecated.
And
exec("php -l $file");
seems to be a wrong way (http://bugs.php.net/bug.php?id=46339)
Thoughts?