On Sat, 20 Dec 2003, Christian Schneider wrote: > Andi Gutmans wrote: > > Anyway, I very strongly feel that an additional optional argument to > > set_error_handler() is the right way to go. > > > > Let's go this way! > > A patch for PHP5 accomplishing this can be found at: > http://cschneid.com/php/php5/set_error_handler_reporting_parameter.patch
By browsing over it it seems that this patch looks wrong, as you forgot to add E_STRICT to E_ALL in line 944 and it would also be better to use zend_parse_parameters. Also because I *really* think that we should not touch this anyway, I did some research and found the following bits of information that clearly describe that the current behavior is 100% *correct* and wanted. The same with the logic in zend_error_cb, there is clearly a two state action: Either you use a customer error_handler which takes responsibility for EVERYTHING itself, or you use the standard error handler. This is a perfectly sane way of doing it by adding your patch things will be more complex and it will defeat the original idea of having your own custom error handling which should handle everything itself. >From the manual: It is important to remember that the standard PHP error handler is completely bypassed. error_reporting() settings will have no effect and your error handler will be called regardless - however you are still able to read the current value of error_reporting and act appropriately. Of particular note is that this value will be 0 if the statement that caused the error was prepended by the @ error-control operator. Also note that it is your responsibility to die() if necessary. If the error-handler function returns, script execution will continue with the next statement after the one that caused an error. http://bugs.php.net/bug.php?id=9779 comment by Torben: [16 Mar 2001 4:36am EST] [EMAIL PROTECTED] Yes, that's by design. error_reporting() allows you to select which errors are shown, while still allowing you to react to errors which, for instance, you might prefer that the user not see. If you do not wish to cope with or know about a certain kind of error, simply have your error handler ignore it. http://bugs.php.net/bug.php?id=14687 comment by Zeev: [28 Dec 2001 9:09am EST] [EMAIL PROTECTED] It's the programmer's responsibility to honor error_reporting in the error handler. The error handler will be called even if the error that occured is not inside the error_reporting mask - to allow you to conduct logging, recovery, etc. You can easily honor it by using the return value of error_reporting(), and compare it (using &) with the error level that you got. http://bugs.php.net/bug.php?id=16570 comment by Jani: [12 Apr 2002 5:08pm EDT] [EMAIL PROTECTED] Not a bug. If @ is used, error_reporting is set to 0. You need to take care of it yourself in your error handler function if you don't want to show errors in that case. This is done this way to let users have as much control as possible in their own error handlers. regards, Derick -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php