[PATCH] - Check configured error level before reporting E_NOTICE messages
| From: | Arvind Srinivasan | Date: | Fri, 30 Oct 2009 12:39:22 +0000 |
| Subject: | [PATCH] - Check configured error level before reporting E_NOTICE messages | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-45914@lists.php.net to get a copy of this message | ||
When compiled with #ifdef ZTS, zend_error invokes pthread_get_specific.
The performance analyzer tool indicated that zend_error was being
invoked during normal processing of requests, even though no error
messages were logged. The source of these calls were E_NOTICE
messages.
Please review the attached patch which introduces a REPORT_ERROR macro
to avoid invoking the zend_error function when the error reporting
level indicates that E_NOTICE messages are not to be reported.
Although, all these codepaths are not executed, I guarded all E_NOTICE
messages using the REPORT_ERROR macro.
thanks,
arvi
diff -r 99ab1d2d0a07 Zend/zend_closures.c --- a/Zend/zend_closures.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_closures.c Thu Oct 22 18:10:54 2009 +0530 @@ -353,7 +353,9 @@ zend_u_hash_quick_add(EG(active_symbol_table), key->type, key->arKey, key->nKeyLength, key->h, &tmp, sizeof(zval*), (void**)&p); } else { p = &EG(uninitialized_zval_ptr); - zend_error(E_NOTICE,"Undefined variable: %s", key->arKey); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %s", key->arKey); + } } } else { if (is_ref) { diff -r 99ab1d2d0a07 Zend/zend_compile.c --- a/Zend/zend_compile.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_compile.c Thu Oct 22 18:10:54 2009 +0530 @@ -2714,7 +2714,7 @@ if (!zend_do_perform_implementation_check(child, child->common.prototype TSRMLS_CC)) { zend_error(E_COMPILE_ERROR, "Declaration of %v::%v() must be compatible with that of %v::%v()", ZEND_FN_SCOPE_NAME(child), child->common.function_name, ZEND_FN_SCOPE_NAME(child->common.prototype), child->common.prototype->common.function_name); } - } else if (EG(error_reporting) & E_STRICT || EG(user_error_handler)) { /* Check E_STRICT (or custom error handler) before the check so that we save some time */ + } else if (REPORT_ERROR(E_STRICT) || EG(user_error_handler)) { /* Check E_STRICT (or custom error handler) before the check so that we save some time */ if (!zend_do_perform_implementation_check(child, parent TSRMLS_CC)) { zend_error(E_STRICT, "Declaration of %v::%v() should be compatible with that of %v::%v()", ZEND_FN_SCOPE_NAME(child), child->common.function_name, ZEND_FN_SCOPE_NAME(parent), parent->common.function_name); } diff -r 99ab1d2d0a07 Zend/zend_constants.c --- a/Zend/zend_constants.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_constants.c Thu Oct 22 18:10:54 2009 +0530 @@ -531,14 +531,18 @@ } if (EG(in_execution) && lookup_name_len == sizeof(ZEND_HALT_CONSTANT_NAME) && ZEND_U_EQUAL(type, name, lookup_name_len-1, ZEND_HALT_CONSTANT_NAME, sizeof(ZEND_HALT_CONSTANT_NAME)-1)) { - zend_error(E_NOTICE,"Constant %R already defined", type, name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Constant %R already defined", type, name); + } if (lookup_name.v) { efree(lookup_name.v); } ret = FAILURE; } if (zend_u_hash_add(EG(zend_constants), type, name, lookup_name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) { - zend_error(E_NOTICE,"Constant %R already defined", type, name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Constant %R already defined", type, name); + } free(c->name.v); if (!(c->flags & CONST_PERSISTENT)) { zval_dtor(&c->value); diff -r 99ab1d2d0a07 Zend/zend_exceptions.c --- a/Zend/zend_exceptions.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_exceptions.c Thu Oct 22 18:10:54 2009 +0530 @@ -759,7 +759,9 @@ MAKE_STD_ZVAL(ex); if (exception_ce) { if (!instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) { - zend_error(E_NOTICE, "Exceptions must be derived from the Exception base class"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Exceptions must be derived from the Exception base class"); + } exception_ce = default_exception_ce; } } else { diff -r 99ab1d2d0a07 Zend/zend_execute.c --- a/Zend/zend_execute.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_execute.c Thu Oct 22 18:10:54 2009 +0530 @@ -250,13 +250,17 @@ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE, "Undefined variable: %v", cv->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Undefined variable: %v", cv->name); + } /* break missing intentionally */ case BP_VAR_IS: return &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE, "Undefined variable: %v", cv->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Undefined variable: %v", cv->name); + } /* break missing intentionally */ case BP_VAR_W: Z_ADDREF(EG(uninitialized_zval)); @@ -903,14 +907,18 @@ if (zend_u_symtable_find(ht, ztype, offset_key, offset_key_length + 1, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: - zend_error(E_NOTICE, "Undefined index: %R", ztype, offset_key); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Undefined index: %R", ztype, offset_key); + } /* break missing intentionally */ case BP_VAR_UNSET: case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined index: %R", ztype, offset_key); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined index: %R", ztype, offset_key); + } /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -939,14 +947,18 @@ if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: - zend_error(E_NOTICE,"Undefined offset: %ld", index); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined offset: %ld", index); + } /* break missing intentionally */ case BP_VAR_UNSET: case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined offset: %ld", index); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined offset: %ld", index); + } /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -1089,7 +1101,9 @@ } if (Z_TYPE_P(overloaded_result) != IS_OBJECT) { zend_class_entry *ce = Z_OBJCE_P(container); - zend_error(E_NOTICE, "Indirect modification of overloaded element of %v has no effect", ce->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Indirect modification of overloaded element of %v has no effect", ce->name); + } } } retval = &overloaded_result; @@ -1178,7 +1192,9 @@ } if (result) { if (Z_LVAL_P(dim) < 0 || Z_UNILEN_P(container) <= Z_LVAL_P(dim)) { - zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim)); + } } container = *container_ptr; result->str_offset.str = container; diff -r 99ab1d2d0a07 Zend/zend_execute_API.c --- a/Zend/zend_execute_API.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_execute_API.c Thu Oct 22 18:10:54 2009 +0530 @@ -593,7 +593,9 @@ if (inline_change && save.v && save.v != actual.v) { efree(save.v); } - zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", actual, actual); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", actual, actual); + } Z_TYPE_P(p) = IS_UNICODE; if (!inline_change) { ZVAL_ZSTRL(p, Z_TYPE_P(p), actual, actual_len, 0); @@ -667,7 +669,9 @@ zend_error(E_ERROR, "Undefined constant '%r'", save); } } - zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", str_index, str_index); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", str_index, str_index); + } ZVAL_TEXTL(&const_value, str_index, str_index_len-3, 1); } diff -r 99ab1d2d0a07 Zend/zend_globals_macros.h --- a/Zend/zend_globals_macros.h Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_globals_macros.h Thu Oct 22 18:10:54 2009 +0530 @@ -48,6 +48,7 @@ # define EG(v) (executor_globals.v) extern ZEND_API zend_executor_globals executor_globals; #endif +#define REPORT_ERROR(x) (EG(error_reporting) & (x)) /* Language Scanner */ #ifdef ZTS diff -r 99ab1d2d0a07 Zend/zend_object_handlers.c --- a/Zend/zend_object_handlers.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_object_handlers.c Thu Oct 22 18:10:54 2009 +0530 @@ -369,7 +369,9 @@ Z_SET_REFCOUNT_P(rv, 0); } if (Z_TYPE_P(rv) != IS_OBJECT) { - zend_error(E_NOTICE, "Indirect modification of overloaded property %v::$%R has no effect", zobj->ce->name, Z_TYPE_P(member), Z_UNIVAL_P(member)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Indirect modification of overloaded property %v::$%R has no effect", zobj->ce->name, Z_TYPE_P(member), Z_UNIVAL_P(member)); + } } } } else { @@ -378,7 +380,9 @@ zval_ptr_dtor(&object); } else { if (!silent) { - zend_error(E_NOTICE,"Undefined property: %v::$%R", zobj->ce->name, Z_TYPE_P(member), Z_STRVAL_P(member)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined property: %v::$%R", zobj->ce->name, Z_TYPE_P(member), Z_STRVAL_P(member)); + } } retval = &EG(uninitialized_zval_ptr); } @@ -1290,7 +1294,9 @@ return SUCCESS; case IS_LONG: ce = Z_OBJCE_P(readobj); - zend_error(E_NOTICE, "Object of class %v could not be converted to int", ce->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Object of class %v could not be converted to int", ce->name); + } INIT_PZVAL(writeobj); if (readobj == writeobj) { zval_dtor(readobj); @@ -1299,7 +1305,9 @@ return SUCCESS; case IS_DOUBLE: ce = Z_OBJCE_P(readobj); - zend_error(E_NOTICE, "Object of class %v could not be converted to double", ce->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Object of class %v could not be converted to double", ce->name); + } INIT_PZVAL(writeobj); if (readobj == writeobj) { zval_dtor(writeobj); diff -r 99ab1d2d0a07 Zend/zend_operators.c --- a/Zend/zend_operators.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_operators.c Thu Oct 22 18:10:54 2009 +0530 @@ -440,7 +440,9 @@ return SUCCESS; } - zend_error(E_NOTICE, "Object of class %v could not be converted to int", Z_OBJCE_P(op)->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Object of class %v could not be converted to int", Z_OBJCE_P(op)->name); + } zval_dtor(op); ZVAL_LONG(op, retval); @@ -507,7 +509,9 @@ return SUCCESS; } - zend_error(E_NOTICE, "Object of class %v could not be converted to double", Z_OBJCE_P(op)->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Object of class %v could not be converted to double", Z_OBJCE_P(op)->name); + } zval_dtor(op); ZVAL_DOUBLE(op, retval); @@ -927,7 +931,9 @@ break; } case IS_ARRAY: - zend_error(E_NOTICE, "Array to string conversion"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Array to string conversion"); + } zval_dtor(op); Z_USTRVAL_P(op) = USTR_MAKE_REL("Array"); Z_USTRLEN_P(op) = sizeof("Array")-1; @@ -965,7 +971,9 @@ return SUCCESS; } - zend_error(E_NOTICE, "Object of class %v to string conversion", Z_OBJCE_P(op)->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Object of class %v to string conversion", Z_OBJCE_P(op)->name); + } zval_dtor(op); Z_USTRVAL_P(op) = USTR_MAKE_REL("Object"); Z_USTRLEN_P(op) = sizeof("Object")-1; @@ -1031,7 +1039,9 @@ break; } case IS_ARRAY: - zend_error(E_NOTICE, "Array to string conversion"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Array to string conversion"); + } zval_dtor(op); Z_STRVAL_P(op) = estrndup_rel("Array", sizeof("Array")-1); Z_STRLEN_P(op) = sizeof("Array")-1; @@ -1069,7 +1079,9 @@ return SUCCESS; } - zend_error(E_NOTICE, "Object of class %v to string conversion", Z_OBJCE_P(op)->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Object of class %v to string conversion", Z_OBJCE_P(op)->name); + } zval_dtor(op); Z_STRVAL_P(op) = estrndup_rel("Object", sizeof("Object")-1); Z_STRLEN_P(op) = sizeof("Object")-1; @@ -2640,7 +2652,9 @@ if (normalize) { if (zend_normalize_identifier(&ret.u, &ret_len, source.u, length, 1) == FAILURE) { - zend_error(E_NOTICE, "Could not normalize identifier"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Could not normalize identifier"); + } ret.u = eustrndup(source.u, length); } } else { @@ -2648,7 +2662,9 @@ zend_case_fold_string(&ret.u, &ret_len, source.u, length, U_FOLD_CASE_DEFAULT, &status); if (U_FAILURE(status)) { - zend_error(E_NOTICE, "Could not case-fold string"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Could not case-fold string"); + } ret.u = eustrndup(source.u, length); } } diff -r 99ab1d2d0a07 Zend/zend_vm_def.h --- a/Zend/zend_vm_def.h Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_vm_def.h Thu Oct 22 18:10:54 2009 +0530 @@ -980,13 +980,17 @@ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -1277,7 +1281,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -2524,7 +2530,9 @@ if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } ZEND_VM_C_GOTO(return_by_value); } @@ -2542,7 +2550,9 @@ if (OP1_TYPE == IS_VAR && !OP1_FREE) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } ZEND_VM_C_GOTO(return_by_value); } } @@ -3080,8 +3090,10 @@ actual_len = Z_UNILEN(opline->op2.u.constant); } /* non-qualified constant - allow text substitution */ - zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", - Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", + Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + } ZVAL_ZSTRL(&EX_T(opline->result.u.var).tmp_var, Z_TYPE(opline->op2.u.constant), actual, actual_len, 1); } else { zend_error_noreturn(E_ERROR, "Undefined constant '%R'", Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant)); @@ -3668,7 +3680,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (IS_OP2_TMP_FREE()) { zval_ptr_dtor(&offset); @@ -4161,14 +4175,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } diff -r 99ab1d2d0a07 Zend/zend_vm_execute.h --- a/Zend/zend_vm_execute.h Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_vm_execute.h Thu Oct 22 18:10:54 2009 +0530 @@ -1323,13 +1323,17 @@ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -1599,7 +1603,9 @@ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } @@ -1617,7 +1623,9 @@ if (IS_CONST == IS_VAR && !0) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } } @@ -2844,8 +2852,10 @@ actual_len = Z_UNILEN(opline->op2.u.constant); } /* non-qualified constant - allow text substitution */ - zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", - Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", + Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + } ZVAL_ZSTRL(&EX_T(opline->result.u.var).tmp_var, Z_TYPE(opline->op2.u.constant), actual, actual_len, 1); } else { zend_error_noreturn(E_ERROR, "Undefined constant '%R'", Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant)); @@ -4757,13 +4767,17 @@ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -5022,7 +5036,9 @@ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } @@ -5040,7 +5056,9 @@ if (IS_TMP_VAR == IS_VAR && !1) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } } @@ -8144,13 +8162,17 @@ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -8403,7 +8425,9 @@ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } @@ -8421,7 +8445,9 @@ if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } } @@ -10372,7 +10398,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -10948,8 +10976,10 @@ actual_len = Z_UNILEN(opline->op2.u.constant); } /* non-qualified constant - allow text substitution */ - zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", - Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", + Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + } ZVAL_ZSTRL(&EX_T(opline->result.u.var).tmp_var, Z_TYPE(opline->op2.u.constant), actual, actual_len, 1); } else { zend_error_noreturn(E_ERROR, "Undefined constant '%R'", Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant)); @@ -11223,7 +11253,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -11338,14 +11370,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -12290,7 +12326,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -13049,7 +13087,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (1) { zval_ptr_dtor(&offset); @@ -13164,14 +13204,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -14116,7 +14160,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -14926,7 +14972,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -15041,14 +15089,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -16593,7 +16645,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -17398,7 +17452,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -17513,14 +17569,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -18117,7 +18177,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -18469,8 +18531,10 @@ actual_len = Z_UNILEN(opline->op2.u.constant); } /* non-qualified constant - allow text substitution */ - zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", - Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", + Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + } ZVAL_ZSTRL(&EX_T(opline->result.u.var).tmp_var, Z_TYPE(opline->op2.u.constant), actual, actual_len, 1); } else { zend_error_noreturn(E_ERROR, "Undefined constant '%R'", Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant)); @@ -18661,7 +18725,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -18775,14 +18841,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -19301,7 +19371,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -19782,7 +19854,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (1) { zval_ptr_dtor(&offset); @@ -19896,14 +19970,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -20422,7 +20500,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -20903,7 +20983,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -21017,14 +21099,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -21803,7 +21889,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -22282,7 +22370,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -22396,14 +22486,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -22735,13 +22829,17 @@ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -22994,7 +23092,9 @@ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } @@ -23012,7 +23112,9 @@ if (IS_CV == IS_VAR && !0) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } } @@ -24793,7 +24895,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -25468,7 +25572,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -25582,14 +25688,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -26530,7 +26640,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -27182,7 +27294,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (1) { zval_ptr_dtor(&offset); @@ -27296,14 +27410,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -28244,7 +28362,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -28946,7 +29066,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -29060,14 +29182,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -30506,7 +30632,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -31203,7 +31331,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -31317,14 +31447,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } diff -r 99ab1d2d0a07 ext/imap/php_imap.c --- a/ext/imap/php_imap.c Thu Sep 17 18:14:38 2009 +0530 +++ b/ext/imap/php_imap.c Thu Oct 22 18:10:54 2009 +0530 @@ -1075,7 +1075,7 @@ if (IMAPG(imap_errorstack) != NIL) { /* output any remaining errors at their original error level */ - if (EG(error_reporting) & E_NOTICE) { + if (REPORT_ERROR(E_NOTICE)) { ecur = IMAPG(imap_errorstack); while (ecur != NIL) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s (errflg=%ld)", ecur->LTEXT, ecur->errflg); @@ -1087,7 +1087,7 @@ if (IMAPG(imap_alertstack) != NIL) { /* output any remaining alerts at E_NOTICE level */ - if (EG(error_reporting) & E_NOTICE) { + if (REPORT_ERROR(E_NOTICE)) { acur = IMAPG(imap_alertstack); while (acur != NIL) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", acur->LTEXT); diff -r 99ab1d2d0a07 main/main.c --- a/main/main.c Thu Sep 17 18:14:38 2009 +0530 +++ b/main/main.c Thu Oct 22 18:10:54 2009 +0530 @@ -1309,7 +1309,7 @@ case ZMSG_MEMORY_LEAK_DETECTED: case ZMSG_MEMORY_LEAK_REPEATED: #if ZEND_DEBUG - if (EG(error_reporting) & E_WARNING) { + if (REPORT_ERROR(E_WARNING)) { char memory_leak_buf[1024]; if (message==ZMSG_MEMORY_LEAK_DETECTED) { @@ -1337,7 +1337,7 @@ break; case ZMSG_MEMORY_LEAKS_GRAND_TOTAL: #if ZEND_DEBUG - if (EG(error_reporting) & E_WARNING) { + if (REPORT_ERROR(E_WARNING)) { char memory_leak_buf[512]; snprintf(memory_leak_buf, 512, "=== Total %d memory leaks detected ===\n", *((zend_uint *) data)); diff -r 99ab1d2d0a07 main/streams/streams.c --- a/main/streams/streams.c Thu Sep 17 18:14:38 2009 +0530 +++ b/main/streams/streams.c Thu Oct 22 18:10:54 2009 +0530 @@ -393,7 +393,7 @@ zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) _php_stream_free_persistent, stream TSRMLS_CC); } #if ZEND_DEBUG - if ((close_options & PHP_STREAM_FREE_RSRC_DTOR) && (stream->__exposed == 0) && (EG(error_reporting) & E_WARNING)) { + if ((close_options & PHP_STREAM_FREE_RSRC_DTOR) && (stream->__exposed == 0) && REPORT_ERROR(E_WARNING)) { /* it leaked: Lets deliberately NOT pefree it so that the memory manager shows it * as leaked; it will log a warning, but lets help it out and display what kind * of stream it was. */
diff -r 99ab1d2d0a07 Zend/zend_closures.c --- a/Zend/zend_closures.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_closures.c Thu Oct 22 18:10:54 2009 +0530 @@ -353,7 +353,9 @@ zend_u_hash_quick_add(EG(active_symbol_table), key->type, key->arKey, key->nKeyLength, key->h, &tmp, sizeof(zval*), (void**)&p); } else { p = &EG(uninitialized_zval_ptr); - zend_error(E_NOTICE,"Undefined variable: %s", key->arKey); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %s", key->arKey); + } } } else { if (is_ref) { diff -r 99ab1d2d0a07 Zend/zend_compile.c --- a/Zend/zend_compile.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_compile.c Thu Oct 22 18:10:54 2009 +0530 @@ -2714,7 +2714,7 @@ if (!zend_do_perform_implementation_check(child, child->common.prototype TSRMLS_CC)) { zend_error(E_COMPILE_ERROR, "Declaration of %v::%v() must be compatible with that of %v::%v()", ZEND_FN_SCOPE_NAME(child), child->common.function_name, ZEND_FN_SCOPE_NAME(child->common.prototype), child->common.prototype->common.function_name); } - } else if (EG(error_reporting) & E_STRICT || EG(user_error_handler)) { /* Check E_STRICT (or custom error handler) before the check so that we save some time */ + } else if (REPORT_ERROR(E_STRICT) || EG(user_error_handler)) { /* Check E_STRICT (or custom error handler) before the check so that we save some time */ if (!zend_do_perform_implementation_check(child, parent TSRMLS_CC)) { zend_error(E_STRICT, "Declaration of %v::%v() should be compatible with that of %v::%v()", ZEND_FN_SCOPE_NAME(child), child->common.function_name, ZEND_FN_SCOPE_NAME(parent), parent->common.function_name); } diff -r 99ab1d2d0a07 Zend/zend_constants.c --- a/Zend/zend_constants.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_constants.c Thu Oct 22 18:10:54 2009 +0530 @@ -531,14 +531,18 @@ } if (EG(in_execution) && lookup_name_len == sizeof(ZEND_HALT_CONSTANT_NAME) && ZEND_U_EQUAL(type, name, lookup_name_len-1, ZEND_HALT_CONSTANT_NAME, sizeof(ZEND_HALT_CONSTANT_NAME)-1)) { - zend_error(E_NOTICE,"Constant %R already defined", type, name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Constant %R already defined", type, name); + } if (lookup_name.v) { efree(lookup_name.v); } ret = FAILURE; } if (zend_u_hash_add(EG(zend_constants), type, name, lookup_name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) { - zend_error(E_NOTICE,"Constant %R already defined", type, name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Constant %R already defined", type, name); + } free(c->name.v); if (!(c->flags & CONST_PERSISTENT)) { zval_dtor(&c->value); diff -r 99ab1d2d0a07 Zend/zend_exceptions.c --- a/Zend/zend_exceptions.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_exceptions.c Thu Oct 22 18:10:54 2009 +0530 @@ -759,7 +759,9 @@ MAKE_STD_ZVAL(ex); if (exception_ce) { if (!instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) { - zend_error(E_NOTICE, "Exceptions must be derived from the Exception base class"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Exceptions must be derived from the Exception base class"); + } exception_ce = default_exception_ce; } } else { diff -r 99ab1d2d0a07 Zend/zend_execute.c --- a/Zend/zend_execute.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_execute.c Thu Oct 22 18:10:54 2009 +0530 @@ -250,13 +250,17 @@ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE, "Undefined variable: %v", cv->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Undefined variable: %v", cv->name); + } /* break missing intentionally */ case BP_VAR_IS: return &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE, "Undefined variable: %v", cv->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Undefined variable: %v", cv->name); + } /* break missing intentionally */ case BP_VAR_W: Z_ADDREF(EG(uninitialized_zval)); @@ -903,14 +907,18 @@ if (zend_u_symtable_find(ht, ztype, offset_key, offset_key_length + 1, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: - zend_error(E_NOTICE, "Undefined index: %R", ztype, offset_key); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Undefined index: %R", ztype, offset_key); + } /* break missing intentionally */ case BP_VAR_UNSET: case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined index: %R", ztype, offset_key); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined index: %R", ztype, offset_key); + } /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -939,14 +947,18 @@ if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: - zend_error(E_NOTICE,"Undefined offset: %ld", index); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined offset: %ld", index); + } /* break missing intentionally */ case BP_VAR_UNSET: case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined offset: %ld", index); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined offset: %ld", index); + } /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -1089,7 +1101,9 @@ } if (Z_TYPE_P(overloaded_result) != IS_OBJECT) { zend_class_entry *ce = Z_OBJCE_P(container); - zend_error(E_NOTICE, "Indirect modification of overloaded element of %v has no effect", ce->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Indirect modification of overloaded element of %v has no effect", ce->name); + } } } retval = &overloaded_result; @@ -1178,7 +1192,9 @@ } if (result) { if (Z_LVAL_P(dim) < 0 || Z_UNILEN_P(container) <= Z_LVAL_P(dim)) { - zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim)); + } } container = *container_ptr; result->str_offset.str = container; diff -r 99ab1d2d0a07 Zend/zend_execute_API.c --- a/Zend/zend_execute_API.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_execute_API.c Thu Oct 22 18:10:54 2009 +0530 @@ -593,7 +593,9 @@ if (inline_change && save.v && save.v != actual.v) { efree(save.v); } - zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", actual, actual); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", actual, actual); + } Z_TYPE_P(p) = IS_UNICODE; if (!inline_change) { ZVAL_ZSTRL(p, Z_TYPE_P(p), actual, actual_len, 0); @@ -667,7 +669,9 @@ zend_error(E_ERROR, "Undefined constant '%r'", save); } } - zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", str_index, str_index); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", str_index, str_index); + } ZVAL_TEXTL(&const_value, str_index, str_index_len-3, 1); } diff -r 99ab1d2d0a07 Zend/zend_globals_macros.h --- a/Zend/zend_globals_macros.h Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_globals_macros.h Thu Oct 22 18:10:54 2009 +0530 @@ -48,6 +48,7 @@ # define EG(v) (executor_globals.v) extern ZEND_API zend_executor_globals executor_globals; #endif +#define REPORT_ERROR(x) (EG(error_reporting) & (x)) /* Language Scanner */ #ifdef ZTS diff -r 99ab1d2d0a07 Zend/zend_object_handlers.c --- a/Zend/zend_object_handlers.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_object_handlers.c Thu Oct 22 18:10:54 2009 +0530 @@ -369,7 +369,9 @@ Z_SET_REFCOUNT_P(rv, 0); } if (Z_TYPE_P(rv) != IS_OBJECT) { - zend_error(E_NOTICE, "Indirect modification of overloaded property %v::$%R has no effect", zobj->ce->name, Z_TYPE_P(member), Z_UNIVAL_P(member)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Indirect modification of overloaded property %v::$%R has no effect", zobj->ce->name, Z_TYPE_P(member), Z_UNIVAL_P(member)); + } } } } else { @@ -378,7 +380,9 @@ zval_ptr_dtor(&object); } else { if (!silent) { - zend_error(E_NOTICE,"Undefined property: %v::$%R", zobj->ce->name, Z_TYPE_P(member), Z_STRVAL_P(member)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined property: %v::$%R", zobj->ce->name, Z_TYPE_P(member), Z_STRVAL_P(member)); + } } retval = &EG(uninitialized_zval_ptr); } @@ -1290,7 +1294,9 @@ return SUCCESS; case IS_LONG: ce = Z_OBJCE_P(readobj); - zend_error(E_NOTICE, "Object of class %v could not be converted to int", ce->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Object of class %v could not be converted to int", ce->name); + } INIT_PZVAL(writeobj); if (readobj == writeobj) { zval_dtor(readobj); @@ -1299,7 +1305,9 @@ return SUCCESS; case IS_DOUBLE: ce = Z_OBJCE_P(readobj); - zend_error(E_NOTICE, "Object of class %v could not be converted to double", ce->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Object of class %v could not be converted to double", ce->name); + } INIT_PZVAL(writeobj); if (readobj == writeobj) { zval_dtor(writeobj); diff -r 99ab1d2d0a07 Zend/zend_operators.c --- a/Zend/zend_operators.c Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_operators.c Thu Oct 22 18:10:54 2009 +0530 @@ -440,7 +440,9 @@ return SUCCESS; } - zend_error(E_NOTICE, "Object of class %v could not be converted to int", Z_OBJCE_P(op)->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Object of class %v could not be converted to int", Z_OBJCE_P(op)->name); + } zval_dtor(op); ZVAL_LONG(op, retval); @@ -507,7 +509,9 @@ return SUCCESS; } - zend_error(E_NOTICE, "Object of class %v could not be converted to double", Z_OBJCE_P(op)->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Object of class %v could not be converted to double", Z_OBJCE_P(op)->name); + } zval_dtor(op); ZVAL_DOUBLE(op, retval); @@ -927,7 +931,9 @@ break; } case IS_ARRAY: - zend_error(E_NOTICE, "Array to string conversion"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Array to string conversion"); + } zval_dtor(op); Z_USTRVAL_P(op) = USTR_MAKE_REL("Array"); Z_USTRLEN_P(op) = sizeof("Array")-1; @@ -965,7 +971,9 @@ return SUCCESS; } - zend_error(E_NOTICE, "Object of class %v to string conversion", Z_OBJCE_P(op)->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Object of class %v to string conversion", Z_OBJCE_P(op)->name); + } zval_dtor(op); Z_USTRVAL_P(op) = USTR_MAKE_REL("Object"); Z_USTRLEN_P(op) = sizeof("Object")-1; @@ -1031,7 +1039,9 @@ break; } case IS_ARRAY: - zend_error(E_NOTICE, "Array to string conversion"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Array to string conversion"); + } zval_dtor(op); Z_STRVAL_P(op) = estrndup_rel("Array", sizeof("Array")-1); Z_STRLEN_P(op) = sizeof("Array")-1; @@ -1069,7 +1079,9 @@ return SUCCESS; } - zend_error(E_NOTICE, "Object of class %v to string conversion", Z_OBJCE_P(op)->name); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Object of class %v to string conversion", Z_OBJCE_P(op)->name); + } zval_dtor(op); Z_STRVAL_P(op) = estrndup_rel("Object", sizeof("Object")-1); Z_STRLEN_P(op) = sizeof("Object")-1; @@ -2640,7 +2652,9 @@ if (normalize) { if (zend_normalize_identifier(&ret.u, &ret_len, source.u, length, 1) == FAILURE) { - zend_error(E_NOTICE, "Could not normalize identifier"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Could not normalize identifier"); + } ret.u = eustrndup(source.u, length); } } else { @@ -2648,7 +2662,9 @@ zend_case_fold_string(&ret.u, &ret_len, source.u, length, U_FOLD_CASE_DEFAULT, &status); if (U_FAILURE(status)) { - zend_error(E_NOTICE, "Could not case-fold string"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Could not case-fold string"); + } ret.u = eustrndup(source.u, length); } } diff -r 99ab1d2d0a07 Zend/zend_vm_def.h --- a/Zend/zend_vm_def.h Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_vm_def.h Thu Oct 22 18:10:54 2009 +0530 @@ -980,13 +980,17 @@ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -1277,7 +1281,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -2524,7 +2530,9 @@ if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } ZEND_VM_C_GOTO(return_by_value); } @@ -2542,7 +2550,9 @@ if (OP1_TYPE == IS_VAR && !OP1_FREE) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } ZEND_VM_C_GOTO(return_by_value); } } @@ -3080,8 +3090,10 @@ actual_len = Z_UNILEN(opline->op2.u.constant); } /* non-qualified constant - allow text substitution */ - zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", - Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", + Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + } ZVAL_ZSTRL(&EX_T(opline->result.u.var).tmp_var, Z_TYPE(opline->op2.u.constant), actual, actual_len, 1); } else { zend_error_noreturn(E_ERROR, "Undefined constant '%R'", Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant)); @@ -3668,7 +3680,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (IS_OP2_TMP_FREE()) { zval_ptr_dtor(&offset); @@ -4161,14 +4175,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } diff -r 99ab1d2d0a07 Zend/zend_vm_execute.h --- a/Zend/zend_vm_execute.h Thu Sep 17 18:14:38 2009 +0530 +++ b/Zend/zend_vm_execute.h Thu Oct 22 18:10:54 2009 +0530 @@ -1323,13 +1323,17 @@ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -1599,7 +1603,9 @@ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } @@ -1617,7 +1623,9 @@ if (IS_CONST == IS_VAR && !0) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } } @@ -2844,8 +2852,10 @@ actual_len = Z_UNILEN(opline->op2.u.constant); } /* non-qualified constant - allow text substitution */ - zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", - Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", + Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + } ZVAL_ZSTRL(&EX_T(opline->result.u.var).tmp_var, Z_TYPE(opline->op2.u.constant), actual, actual_len, 1); } else { zend_error_noreturn(E_ERROR, "Undefined constant '%R'", Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant)); @@ -4757,13 +4767,17 @@ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -5022,7 +5036,9 @@ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } @@ -5040,7 +5056,9 @@ if (IS_TMP_VAR == IS_VAR && !1) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } } @@ -8144,13 +8162,17 @@ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -8403,7 +8425,9 @@ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } @@ -8421,7 +8445,9 @@ if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } } @@ -10372,7 +10398,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -10948,8 +10976,10 @@ actual_len = Z_UNILEN(opline->op2.u.constant); } /* non-qualified constant - allow text substitution */ - zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", - Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", + Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + } ZVAL_ZSTRL(&EX_T(opline->result.u.var).tmp_var, Z_TYPE(opline->op2.u.constant), actual, actual_len, 1); } else { zend_error_noreturn(E_ERROR, "Undefined constant '%R'", Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant)); @@ -11223,7 +11253,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -11338,14 +11370,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -12290,7 +12326,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -13049,7 +13087,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (1) { zval_ptr_dtor(&offset); @@ -13164,14 +13204,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -14116,7 +14160,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -14926,7 +14972,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -15041,14 +15089,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -16593,7 +16645,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -17398,7 +17452,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -17513,14 +17569,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -18117,7 +18177,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -18469,8 +18531,10 @@ actual_len = Z_UNILEN(opline->op2.u.constant); } /* non-qualified constant - allow text substitution */ - zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", - Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'", + Z_TYPE(opline->op2.u.constant), actual, Z_TYPE(opline->op2.u.constant), actual); + } ZVAL_ZSTRL(&EX_T(opline->result.u.var).tmp_var, Z_TYPE(opline->op2.u.constant), actual, actual_len, 1); } else { zend_error_noreturn(E_ERROR, "Undefined constant '%R'", Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant)); @@ -18661,7 +18725,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -18775,14 +18841,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -19301,7 +19371,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -19782,7 +19854,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (1) { zval_ptr_dtor(&offset); @@ -19896,14 +19970,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -20422,7 +20500,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -20903,7 +20983,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -21017,14 +21099,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -21803,7 +21889,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -22282,7 +22370,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -22396,14 +22486,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -22735,13 +22829,17 @@ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE,"Undefined variable: %R", Z_TYPE_P(varname), Z_UNIVAL_P(varname)); + } /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -22994,7 +23092,9 @@ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } @@ -23012,7 +23112,9 @@ if (IS_CV == IS_VAR && !0) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } - zend_error(E_NOTICE, "Only variable references should be returned by reference"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Only variable references should be returned by reference"); + } goto return_by_value; } } @@ -24793,7 +24895,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -25468,7 +25572,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -25582,14 +25688,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -26530,7 +26640,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -27182,7 +27294,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (1) { zval_ptr_dtor(&offset); @@ -27296,14 +27410,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -28244,7 +28362,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -28946,7 +29066,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -29060,14 +29182,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } @@ -30506,7 +30632,9 @@ if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to get property of non-object"); + } } if (!RETURN_VALUE_UNUSED(&opline->result)) { AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); @@ -31203,7 +31331,9 @@ if (Z_OBJ_HT_P(*container)->unset_property) { Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to unset property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } } if (0) { zval_ptr_dtor(&offset); @@ -31317,14 +31447,18 @@ if (Z_OBJ_HT_P(*container)->has_property) { result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check property of non-object"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check property of non-object"); + } result = 0; } } else { if (Z_OBJ_HT_P(*container)->has_dimension) { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } else { - zend_error(E_NOTICE, "Trying to check element of non-array"); + if (REPORT_ERROR(E_NOTICE)) { + zend_error(E_NOTICE, "Trying to check element of non-array"); + } result = 0; } } diff -r 99ab1d2d0a07 ext/imap/php_imap.c --- a/ext/imap/php_imap.c Thu Sep 17 18:14:38 2009 +0530 +++ b/ext/imap/php_imap.c Thu Oct 22 18:10:54 2009 +0530 @@ -1075,7 +1075,7 @@ if (IMAPG(imap_errorstack) != NIL) { /* output any remaining errors at their original error level */ - if (EG(error_reporting) & E_NOTICE) { + if (REPORT_ERROR(E_NOTICE)) { ecur = IMAPG(imap_errorstack); while (ecur != NIL) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s (errflg=%ld)", ecur->LTEXT, ecur->errflg); @@ -1087,7 +1087,7 @@ if (IMAPG(imap_alertstack) != NIL) { /* output any remaining alerts at E_NOTICE level */ - if (EG(error_reporting) & E_NOTICE) { + if (REPORT_ERROR(E_NOTICE)) { acur = IMAPG(imap_alertstack); while (acur != NIL) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", acur->LTEXT); diff -r 99ab1d2d0a07 main/main.c --- a/main/main.c Thu Sep 17 18:14:38 2009 +0530 +++ b/main/main.c Thu Oct 22 18:10:54 2009 +0530 @@ -1309,7 +1309,7 @@ case ZMSG_MEMORY_LEAK_DETECTED: case ZMSG_MEMORY_LEAK_REPEATED: #if ZEND_DEBUG - if (EG(error_reporting) & E_WARNING) { + if (REPORT_ERROR(E_WARNING)) { char memory_leak_buf[1024]; if (message==ZMSG_MEMORY_LEAK_DETECTED) { @@ -1337,7 +1337,7 @@ break; case ZMSG_MEMORY_LEAKS_GRAND_TOTAL: #if ZEND_DEBUG - if (EG(error_reporting) & E_WARNING) { + if (REPORT_ERROR(E_WARNING)) { char memory_leak_buf[512]; snprintf(memory_leak_buf, 512, "=== Total %d memory leaks detected ===\n", *((zend_uint *) data)); diff -r 99ab1d2d0a07 main/streams/streams.c --- a/main/streams/streams.c Thu Sep 17 18:14:38 2009 +0530 +++ b/main/streams/streams.c Thu Oct 22 18:10:54 2009 +0530 @@ -393,7 +393,7 @@ zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) _php_stream_free_persistent, stream TSRMLS_CC); } #if ZEND_DEBUG - if ((close_options & PHP_STREAM_FREE_RSRC_DTOR) && (stream->__exposed == 0) && (EG(error_reporting) & E_WARNING)) { + if ((close_options & PHP_STREAM_FREE_RSRC_DTOR) && (stream->__exposed == 0) && REPORT_ERROR(E_WARNING)) { /* it leaked: Lets deliberately NOT pefree it so that the memory manager shows it * as leaked; it will log a warning, but lets help it out and display what kind * of stream it was. */