diff --git a/coverager.c b/coverager.c index f9d89f3..b5e33ba 100644 --- a/coverager.c +++ b/coverager.c @@ -233,6 +233,7 @@ void xc_coverager_request_shutdown(TSRMLS_D) /* {{{ */ xc_coverager_save_cov(ZSTR_S(s), outfilename, *pcov TSRMLS_CC); zend_hash_move_forward(XG(coverages)); } + efree(outfilename); } zend_hash_destroy(XG(coverages)); diff --git a/coverager/config.php.example b/coverager/config.php.example index 10bd45c..b6a5ec3 100644 --- a/coverager/config.php.example +++ b/coverager/config.php.example @@ -12,7 +12,13 @@ $usecache = false; function ob_filter_path_nicer($o) { - $o = str_replace("/home/", "{H}/", $o); + $sep = DIRECTORY_SEPARATOR; + $o = str_replace($_SERVER['DOCUMENT_ROOT'], "{DOCROOT}$sep", $o); + $xcachedir = realpath(dirname(__FILE__) . "$sep..$sep"); + $o = str_replace($xcachedir . $sep, "{XCache}$sep", $o); + if ($sep == '/') { + $o = str_replace("/home/", "{H}/", $o); + } return $o; } diff --git a/coverager/coverager.php b/coverager/coverager.php index 97c4960..20c6d4e 100644 --- a/coverager/coverager.php +++ b/coverager/coverager.php @@ -57,7 +57,9 @@ class XcacheCoverageViewer $this->path = isset($_GET['path']) ? $_GET['path'] : ''; $this->path = preg_replace('!\.{2,}!', '.', $this->path); - $this->path = preg_replace('![\\\\/]{2,}!', '/', $this->path); + $qsep = preg_quote(DIRECTORY_SEPARATOR, '!'); + $this->path = preg_replace("![\\\\$qsep]{2,}!", DIRECTORY_SEPARATOR, $this->path); + $this->path = preg_replace("!$qsep$!", '', $this->path); if ($this->path == '/') { $this->path = ''; } @@ -113,7 +115,7 @@ class XcacheCoverageViewer list($tplfile, $tpllines, $tplcov) = $this->loadTplCov($fileinfo['cov'], substr($this->outpath, $this->datadir_len)); if ($tplfile) { - $tplcov = sprint_cov($tplinfo['tplcov'], $tpllines); + $tplcov = sprint_cov($tplcov, $tpllines); unset($tpllines); } } diff --git a/coverager/coverager.tpl.php b/coverager/coverager.tpl.php index 6ae2eaa..b2a9ccc 100644 --- a/coverager/coverager.tpl.php +++ b/coverager/coverager.tpl.php @@ -1,7 +1,6 @@ - charset" /> @@ -60,6 +59,7 @@ function dir_row($info, $srcdir) { global $cycle; if ($info['files'] || $info['todos']) { + $srcdir .= DIRECTORY_SEPARATOR; $c = $cycle->next(); $srcdir_html = htmlspecialchars($srcdir); $todos = number_format($info['todos']);