From: Ilia Alshanetsky Date: Mon, 18 Sep 2006 23:08:36 +0000 (+0000) Subject: Avoid generating php_errormsg twice in some instances. X-Git-Tag: php-5.2.0RC5~134 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fe6effeeb4d155391831e27f7332630a135c3004;p=php Avoid generating php_errormsg twice in some instances. --- diff --git a/main/main.c b/main/main.c index aefeeb1a4b..b9249ba4f0 100644 --- a/main/main.c +++ b/main/main.c @@ -572,7 +572,8 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c efree(docref_buf); } - if (PG(track_errors) && module_initialized && EG(active_symbol_table)) { + if (PG(track_errors) && module_initialized && EG(active_symbol_table) && + (!EG(user_error_handler) || !(EG(user_error_handler_error_reporting) & type))) { zval *tmp; ALLOC_INIT_ZVAL(tmp); ZVAL_STRINGL(tmp, buffer, buffer_len, 1); @@ -846,16 +847,14 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ efree(buffer); return; } + if (PG(track_errors) && module_initialized && EG(active_symbol_table)) { zval *tmp; - - ALLOC_ZVAL(tmp); - INIT_PZVAL(tmp); - Z_STRVAL_P(tmp) = (char *) estrndup(buffer, buffer_len); - Z_STRLEN_P(tmp) = buffer_len; - Z_TYPE_P(tmp) = IS_STRING; + ALLOC_INIT_ZVAL(tmp); + ZVAL_STRINGL(tmp, buffer, buffer_len, 1); zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(zval *), NULL); } + efree(buffer); } /* }}} */