Permalink
Browse files

Fixed bug #728: Profiler reports __call() invocations confusingly/wro…

…ngly.
  • Loading branch information...
1 parent 06bb766 commit e14d2e58f281e6709d1a1b6046eb8681b4f31d9b @derickr committed Apr 28, 2012
Showing with 10 additions and 5 deletions.
  1. +4 −0 xdebug.c
  2. +6 −5 xdebug_profiler.c
View
@@ -1331,6 +1331,10 @@ void xdebug_execute(zend_op_array *op_array TSRMLS_DC)
}
fse = xdebug_add_stack_frame(edata, op_array, XDEBUG_EXTERNAL TSRMLS_CC);
+ /* A hack to make __call work with profiles. The function *is* user defined after all. */
+ if (fse && fse->prev && fse->function.function && (strcmp(fse->function.function, "__call") == 0)) {
+ fse->prev->user_defined = XDEBUG_EXTERNAL;
+ }
function_nr = XG(function_count);
xdebug_trace_function_begin(fse, function_nr TSRMLS_CC);
View
@@ -176,14 +176,15 @@ void xdebug_profiler_function_user_end(function_stack_entry *fse, zend_op_array*
xdebug_llist_insert_next(fse->prev->profile.call_list, NULL, ce);
}
- if (op_array) {
- fprintf(XG(profile_file), "fl=%s\n", op_array->filename);
- } else {
- fprintf(XG(profile_file), "fl=php:internal\n");
- }
if (fse->user_defined == XDEBUG_EXTERNAL) {
+ if (op_array) {
+ fprintf(XG(profile_file), "fl=%s\n", op_array->filename);
+ } else {
+ fprintf(XG(profile_file), "fl=%s\n", fse->filename);
+ }
fprintf(XG(profile_file), "fn=%s\n", tmp_name);
} else {
+ fprintf(XG(profile_file), "fl=php:internal\n");
fprintf(XG(profile_file), "fn=php::%s\n", tmp_name);
}
xdfree(tmp_name);

0 comments on commit e14d2e5

Please sign in to comment.