Skip to content

Commit

Permalink
Fixed issue #1246: Path and branch coverage should be initialised per…
Browse files Browse the repository at this point in the history
… request, not globally
  • Loading branch information
derickr committed May 28, 2016
1 parent 7c4b448 commit 5ff283c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion xdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ static void php_xdebug_init_globals (zend_xdebug_globals *xg TSRMLS_DC)
xg->previous_file = NULL;
xg->previous_mark_filename = "";
xg->previous_mark_file = NULL;
xg->paths_stack = xdebug_path_info_ctor();
xg->paths_stack = NULL;
xg->branches.size = 0;
xg->branches.last_branch_nr = NULL;
xg->do_code_coverage = 0;
Expand Down Expand Up @@ -1210,6 +1210,10 @@ PHP_RINIT_FUNCTION(xdebug)
/* Signal that we're in a request now */
XG(in_execution) = 1;

XG(paths_stack) = xdebug_path_info_ctor();
XG(branches).size = 0;
XG(branches).last_branch_nr = NULL;

return SUCCESS;
}

Expand Down Expand Up @@ -1313,6 +1317,7 @@ ZEND_MODULE_POST_ZEND_DEACTIVATE_D(xdebug)
/* Clean up path coverage array */
if (XG(paths_stack)) {
xdebug_path_info_dtor(XG(paths_stack));
XG(paths_stack) = NULL;
}
if (XG(branches).last_branch_nr) {
free(XG(branches).last_branch_nr);
Expand Down
2 changes: 2 additions & 0 deletions xdebug_branch_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,10 @@ void xdebug_path_info_dtor(xdebug_path_info *path_info)
xdebug_path_free(path_info->paths[i]);
}
xdfree(path_info->paths);
path_info->paths = NULL;
if (path_info->path_hash) {
xdebug_hash_destroy(path_info->path_hash);
path_info->path_hash = NULL;
}
}

Expand Down

0 comments on commit 5ff283c

Please sign in to comment.