ID:               26883
 User updated by:  xuefer at 21cn dot com
 Reported By:      xuefer at 21cn dot com
 Status:           Closed
 Bug Type:         Performance problem
 Operating System: *
 PHP Version:      5CVS-2004-01-12 (dev)
 New Comment:

eh? sorry, but i don't see the changes?

my recommend change is for zend.c
http://cvs.php.net/cvs.php/ZendEngine2/zend.c?login=2

what i said "this change require" means those patch should not be
revert because of this feature request


Previous Comments:
------------------------------------------------------------------------

[2004-01-12 10:04:00] [EMAIL PROTECTED]

Already done:

revision 1.222
date: 2004/01/10 11:43:41;  author: zeev;  state: Exp;  lines: +13 -8
Added error mask to set_error_handler()
Patch by Christian Schneider <[EMAIL PROTECTED]>



------------------------------------------------------------------------

[2004-01-12 08:58:18] xuefer at 21cn dot com

Description:
------------
the idea is from the internals mailinglist recently that discuss about
2nd argument for set_error_handler.
it seems error mask is not going to be used, as i saw no changes in
zend.c function zend_error()
but i'm talking about performance here.


many php scripters use:
$page = (int) @ $_GET['page'];
$id = (int) @ $_GET['id'];
etc etc..
and they use set_error_handler('myErrorHandler');
and 
function myErrorHandler($errstr, $errno, ...)
{
 if (! (error_reporting() & $errno) ) {
   return;
 }
 ..
}

for just every undefined index of page/id
bunch of code in zend_error() is executed and then user defined
function "myErrorHandler", and then error_reporting()

callback set_error_handler(callback handler, [int error_mask]);

error_mask default to NULL(or 0), means "don't check with mask", which
is BackCompat with old scripts

for most scripters, use
set_error_handler('myErrorHandler', E_ALL);
and (error_reporting() & $error_mask) is check BEFORE calling
myErrorHandler


===== change ===
        /* if we don't have a user defined error handler */
        if (!EG(user_error_handler)) {
                zend_error_cb(type, error_filename, error_lineno, format, args);
        } else switch (type) {

==== into ====
        /* if we don't have a user defined error handler */
        if (!EG(user_error_handler)
 || !EG(user_error_handler_error_reporting)
 || !((EG(user_error_handler_error_reporting) & type)) {
                zend_error_cb(type, error_filename, error_lineno, format, args);
        } else switch (type) {


this change require:
http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?login=2&r1=1.221&r2=1.222&ty=h

Last Log Message for rev 1.222:
Added error mask to set_error_handler()




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=26883&edit=1

Reply via email to