this makes coverage dumping work on windows; on windows the cwd is changed to the apache executable's path by the time the coverage end is reached, changing the coverage end function to a closure that gives back a function with the actual shimmie cwd stored fixes this

This commit is contained in:
Christian Walde 2010-07-30 22:48:32 +02:00
parent e9cabb30b3
commit e5b3afb31c
2 changed files with 10 additions and 6 deletions

View file

@ -991,11 +991,15 @@ function _start_coverage() {
function _end_coverage() {
if(function_exists("xdebug_get_code_coverage")) {
if(!file_exists("data/coverage")) mkdir("data/coverage");
$n = 0;
$t = time();
while(file_exists("data/coverage/$t.$n.log")) $n++;
file_put_contents("data/coverage/$t.$n.log", serialize(xdebug_get_code_coverage()));
$dir = getcwd();
$end_cov = function() use ( $dir ) {
if(!file_exists("$dir/data/coverage")) mkdir("$dir/data/coverage");
$n = 0;
$t = time();
while(file_exists("$dir/data/coverage/$t.$n.log")) $n++;
file_put_contents("$dir/data/coverage/$t.$n.log", serialize(xdebug_get_code_coverage()));
};
return $end_cov;
}
}
?>

View file

@ -68,7 +68,7 @@ require_once "config.php";
require_once "core/util.inc.php";
if(COVERAGE) {
_start_coverage();
register_shutdown_function("_end_coverage");
register_shutdown_function(_end_coverage());
}
_version_check();
_sanitise_environment();