ID: 32101 Comment by: gerrit dot boettcher at gmail dot com Reported By: ceefour at gauldong dot net Status: No Feedback Bug Type: Scripting Engine problem Operating System: * PHP Version: 5CVS-2005-02-15 New Comment:
Got the same Problem with the ErrorHandler Just in win32. In Linux this works great. SourceCode: ------------------------------------------- --- header.php (Load before any output started or other PHP files loaded) set_error_handler(array('main','handleError'), E_ALL); --- main.class.php final class main { [...] public static function handleError($errorNo, $message, $filename, $lineNo) { $errReport = error_reporting(); if ($errReport != 0) { if ($errorNo != 8) { $type = 'error'; switch ($errorNo) { case 2: $type = 'warning'; break; } throw new SystemException('PHP '.$type.' in file '.$filename.' ('.$lineNo.'): '.$message, 0); } } } [...] } --- systemexception.class.php (loaded before main.class.php) require_once('exceptions/printableexception.class.php'); class SystemException extends Exception implements PrintableException { [...] public function show() { echo '...[...template...]...'; } [...] } --- printableexception.class.php interface PrintableException { public function show(); } ----------- EOF -------------- On Linux Systems: anything works great! On Windows Systems: Exception thrown without a stack frame in Unknown on line 0 Previous Comments: ------------------------------------------------------------------------ [2007-01-09 09:15:23] dhopkins at DonHopkins dot com This just demonstrates yet again that the PHP team deserves their infamous reputation for sweeping bugs and security holes under the rug. You guys really go out of your way to pretend to misunderstand the bug reports. I am still getting this same problem, for example when the code throws an exception inside a destructor. The error message says "IN UNKNOWN ON LINE 0". That is the problem. The error message should GIVE THE NAME OF THE FILE AND THE LINE NUMBER. The bug is not that the message is "confusing" or that the programmer WANTS to throw an exception inside a destructor or exception handler. The bug is that the error message is totally useless for figuring out WHERE THE ERROR HAPPENED. I am faced with this stupid uninformative error message happening in a huge body of (of course) badly written PHP code (is there anything BUT badly written PHP code?). And I have no way to diagnose what buggy line out of tens of thousands of lines of PHP code is causing this. I don't know if it's because it's throwing an exception in a destructor, or in another exception handler. It might be doing either or both. But I have no way of telling because the idiotic error message does not tell me what line of code the problem is on. Don't tell me that's the way it's supposed to behave. ------------------------------------------------------------------------ [2005-07-30 23:57:48] james at academicsuperstore dot com I am experiencing the same problem using 5.0.4. ------------------------------------------------------------------------ [2005-05-21 01:00:04] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2005-05-13 13:33:49] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2005-02-25 11:20:24] ceefour at gauldong dot net This modified code may be better illustrate the problem: <?php function error_handler() { trigger_error("inside error", E_USER_ERROR); } set_error_handler('error_handler'); trigger_error("outside error", E_USER_ERROR); function exception_handler($exception) { throw new Exception('inside exception'); } set_exception_handler('exception_handler'); throw new Exception('outside exception'); ?> ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/32101 -- Edit this bug report at http://bugs.php.net/?id=32101&edit=1