Edit report at https://bugs.php.net/bug.php?id=54033&edit=1
ID: 54033 Comment by: matthew dot bonner at gmail dot com Reported by: tyra3l at gmail dot com Summary: add get_error_handler and get_exception handler Status: Open Type: Feature/Change Request Package: Scripting Engine problem PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: I'm not sure the focus was of the exception handler and the reason I bring this up is you have mentioned about restoring the exception handler, however I think this bug applies to exceptions as well. I think for security alone, you should be able to call get_error_handler as if a rogue script has overridden the error handler you have no way of knowing without changing the error handler. Because there is no get_error_handler() you have to type: function tempErrorHandler () {} $previousErrorHandler = set_error_handler('tempErrorHandler'); restore_error_handler(); Even worse, people are probably writing a function called get_error_handler() to do this because you haven't provided this functionality. This means when you come to implement something like this you will have to provide enough time for people to remove their own implementation of this function. Another issue is how to restore the original PHP error handler, take for instance the following scenario: function tempErrorHandler () {} function basicErrorHandler () {} set_error_handler('tempErrorHandler'); set_error_handler('basicErrorHandler'); Calling restore_error_handler() restores the tempErrorHandler, that's great, we now have an error handler that is doing nothing. Please seriously reconsider your stance on the functionality provided for both the error and exception handling. Previous Comments: ------------------------------------------------------------------------ [2012-03-18 16:46:11] tyr...@php.net sorry for my last two changes about this issue. ------------------------------------------------------------------------ [2012-03-18 16:41:54] tyra3l at gmail dot com asd ------------------------------------------------------------------------ [2012-03-18 16:41:41] tyra3l at gmail dot com test ------------------------------------------------------------------------ [2011-02-18 11:45:20] tyra3l at gmail dot com the get_exception_handler is least important for me: I cannot come up with a situation, which couldn't be solved by set_exception_handler and restore_exception_handler, because the exception handler doesn't have something like the $error_types in the set_error_handler. but I think it would be more consistent if both the error and exception handler functions would provide that. Tyrael ------------------------------------------------------------------------ [2011-02-17 01:04:00] tyra3l at gmail dot com of course it returns the callback. but: - you can't get it without overwriting - it doesn't return the error_types, hence you won't know on which error should you call the previous handler - if you would think, that maybe the restore_error_handler would come to the rescue(you set your error handler, in your error handler you catch everything, and restore the previous handler for the errors that isn't for you and and call the original error handler with trigger_error): you can only tigger E_USER_*. :( am I missing something? if not, please re-open the issue, because it isn't bogus. Tyrael ------------------------------------------------------------------------ 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 https://bugs.php.net/bug.php?id=54033 -- Edit this bug report at https://bugs.php.net/bug.php?id=54033&edit=1