[patch] Zend/zend_execute.c - bug #27290 (warning msg on missing function argument should mention file/line of caller too)
| From: | Antony Dovgal | Date: | Fri, 10 Sep 2004 05:56:57 +0000 |
| Subject: | [patch] Zend/zend_execute.c - bug #27290 (warning msg on missing function argument should mention file/line of caller too) | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-12695@lists.php.net to get a copy of this message | ||
Hi all.
The attached patch fixes bug #27290 (which could be considered as feature request).
The patch proposes to look at the previous op_code to get real line number & filename where the
fuction was called.
--
Wbr,
Antony Dovgal aka tony2001
tony2001@phpclub.net || antony@dovgal.com
Index: zend_execute.c =================================================================== RCS file: /repository/ZendEngine2/zend_execute.c,v retrieving revision 1.673 diff -u -r1.673 zend_execute.c --- zend_execute.c 9 Sep 2004 16:47:22 -0000 1.673 +++ zend_execute.c 10 Sep 2004 05:34:37 -0000 @@ -3371,8 +3371,18 @@ if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) { char *space; char *class_name = get_active_class_name(&space TSRMLS_CC); + zend_execute_data *ptr = EG(current_execute_data); + + ptr = ptr->prev_execute_data; + zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL TSRMLS_CC); - zend_error(E_WARNING, "Missing argument %ld for %s%s%s()", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C)); + if (ptr && ptr->op_array) { + zend_error(E_WARNING, "Missing argument %ld for %s%s%s(), called in %s on line %d and defined", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno); + } + else { + zend_error(E_WARNING, "Missing argument %ld for %s%s%s()", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C)); + } + if (opline->result.op_type == IS_VAR) { PZVAL_UNLOCK_FREE(*EX_T(opline->result.u.var).var.ptr_ptr); }
Index: zend_execute.c =================================================================== RCS file: /repository/ZendEngine2/zend_execute.c,v retrieving revision 1.673 diff -u -r1.673 zend_execute.c --- zend_execute.c 9 Sep 2004 16:47:22 -0000 1.673 +++ zend_execute.c 10 Sep 2004 05:34:37 -0000 @@ -3371,8 +3371,18 @@ if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) { char *space; char *class_name = get_active_class_name(&space TSRMLS_CC); + zend_execute_data *ptr = EG(current_execute_data); + + ptr = ptr->prev_execute_data; + zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL TSRMLS_CC); - zend_error(E_WARNING, "Missing argument %ld for %s%s%s()", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C)); + if (ptr && ptr->op_array) { + zend_error(E_WARNING, "Missing argument %ld for %s%s%s(), called in %s on line %d and defined", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno); + } + else { + zend_error(E_WARNING, "Missing argument %ld for %s%s%s()", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C)); + } + if (opline->result.op_type == IS_VAR) { PZVAL_UNLOCK_FREE(*EX_T(opline->result.u.var).var.ptr_ptr); }