From: d dot albano at gmail dot com Operating system: Linux PHP version: 5.2.3 PHP Bug Type: Scripting Engine problem Bug description: Unable to catch Parse Errors
Description: ------------ Hi, i've seen that set_error_handler doesn't let to the code to catch Parse Errors. I know that set_error_handler documentation page on php manual says that this error can't be catched, so this isin't a true bug: it is something like a logical bug because using strange tricks you can catch parse errors for included files. So, instead to force php developers to do strange tricks to catch parse errors why don't try to send parse errors throught user defined error handler, if it is setted? I know that this isin't so simply but it is becoming necessary: in an advanced system is vitally catch any kind of error that can cause problem to page execution and this comprises catching every kind of errors that can be generated by third party module or every included file. I understand that there isin't an easy way to do but a point of start can be define it through htaccess/php_value or simply use it only with included files after that set_error_handler is setted Reproduce code: --------------- # main.php: <?php function error_handler($errno, $errstr, $errfile, $errline) { echo 'error catched!'; } set_error_handler('error_handler'); require_once('file_with_parse_error.php'); ?> # file_with_parse_error.php: <?php --- this is a voluntary php parse error --- ?> Expected result: ---------------- Browser should show: error catched! Actual result: -------------- Browser output: Parse error: syntax error, .... -- Edit bug report at http://bugs.php.net/?id=41810&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41810&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41810&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41810&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41810&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41810&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41810&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41810&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41810&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41810&r=support Expected behavior: http://bugs.php.net/fix.php?id=41810&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41810&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41810&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41810&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41810&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41810&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41810&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41810&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41810&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41810&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41810&r=mysqlcfg