From: Zeev Suraski Date: Sun, 19 Aug 2001 13:39:06 +0000 (+0000) Subject: MFZE1 X-Git-Tag: PRE_SUBST_Z_MACROS~440 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4340c57ece187e719869c220752359a40c0c49f5;p=php MFZE1 --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d6ca4de280..a50ebc773a 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1149,8 +1149,18 @@ ZEND_API int do_bind_function_or_class(zend_op *opline, HashTable *function_tabl zend_hash_find(function_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void *) &function); if (zend_hash_add(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, function, sizeof(zend_function), NULL)==FAILURE) { int error_level = compile_time ? E_COMPILE_ERROR : E_ERROR; - - zend_error(error_level, "Cannot redeclare %s()", opline->op2.u.constant.value.str.val); + zend_function *function; + + if (zend_hash_find(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void *) &function)==SUCCESS + && function->type==ZEND_USER_FUNCTION + && ((zend_op_array *) function)->last>0) { + zend_error(error_level, "Cannot redeclare %s() (previously declared in %s:%d)", + opline->op2.u.constant.value.str.val, + ((zend_op_array *) function)->filename, + ((zend_op_array *) function)->opcodes[0].lineno); + } else { + zend_error(error_level, "Cannot redeclare %s()", opline->op2.u.constant.value.str.val); + } return FAILURE; } else { (*function->op_array.refcount)++;