Closed nitemare closed 11 years ago
Parse errors are always uncatchable; except using register_shutdown_function(), as demonstrated in http://blog.ramonlechuga.com/tag/php-error-handling/ . PHP-Error does this, but it can't work when the file that loads PHP-Error doesn't even execute because PHP balks out at the parsing stage. They can, however, be caught in included files. See http://stackoverflow.com/questions/1900208/php-custom-error-handler-handling-parse-fatal-errors
I can catch some parse errors, but not all. It really depends. If I remember correctly, you can catch parse errors if they are not in the first file that gets executed. i.e. if you import a file with a parse error.
Like @demonkoryu said, it's due to how PHP has uncatchable errors.
You can however install XDebug as a fallback for this. It means you'll have PHP Error for 99% of errors, and XDebug for those I can't get.
@JosephLenton It is possible using auto_prepend_file. Maybe you want to make a tiny addition to PHP-Error and add instructions for this; if not, I could do it if you want.
I've set it up with the default settings on a test file, and made a simple error ( i typed "blah(;" with no quotes. and it still gives the standard PHP error: Parse error: syntax error, unexpected ';', expecting ')' in/test.php on line 9
how ever, if i type a function that doesn't exist such as "blah();" then php_error will work corectly. whats going on?