From e5b3afb31ceb33157db58f56e67a4759d0e57e01 Mon Sep 17 00:00:00 2001 From: Christian Walde <walde.christian@googlemail.com> Date: Fri, 30 Jul 2010 22:48:32 +0200 Subject: [PATCH] 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 --- core/util.inc.php | 14 +++++++++----- index.php | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/core/util.inc.php b/core/util.inc.php index d6848538..4138965d 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -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; } } ?> diff --git a/index.php b/index.php index 15a4e2c0..22137809 100644 --- a/index.php +++ b/index.php @@ -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();