Skip to content

Commit

Permalink
Merged pull request xdebug#34
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Oct 21, 2012
2 parents e3f7557 + ca3aa94 commit 9da6d93
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/bug00879.inc
@@ -0,0 +1,7 @@
<?php

trait T {}

class WithTrait {
use T;
}
59 changes: 59 additions & 0 deletions tests/bug00879.phpt
@@ -0,0 +1,59 @@
--TEST--
Test for bug #879: Closing brace in trait-using class definitions is counted towards code coverage. (PHP >= 5.4)
--SKIPIF--
<?php if (version_compare(phpversion(), "5.4", '<')) echo "skip >= PHP 5.4 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
xdebug.trace_options=0
xdebug.trace_output_dir=/tmp
xdebug.collect_params=1
xdebug.collect_return=0
xdebug.collect_assignments=0
xdebug.auto_profile=0
xdebug.profiler_enable=0
xdebug.dump_globals=0
xdebug.show_mem_delta=0
xdebug.trace_format=0
xdebug.extended_info=1
xdebug.coverage_enable=1
xdebug.overload_var_dump=0
--FILE--
<?php

xdebug_start_code_coverage(XDEBUG_CC_UNUSED);

$file = realpath('./tests/bug00879.inc');
include $file;

new WithTrait;

var_dump(xdebug_get_code_coverage());
?>
--EXPECTF--
array(2) {
["%sbug00879.inc"]=>
array(5) {
[3]=>
int(1)
[5]=>
int(1)
[6]=>
int(1)
[7]=>
int(1)
[8]=>
int(1)
}
["%sbug00879.php"]=>
array(4) {
[5]=>
int(1)
[6]=>
int(1)
[8]=>
int(1)
[10]=>
int(1)
}
}
4 changes: 4 additions & 0 deletions xdebug.c
Expand Up @@ -629,6 +629,10 @@ PHP_MINIT_FUNCTION(xdebug)
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_QM_ASSIGN);
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) || PHP_MAJOR_VERSION >= 6
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_DECLARE_LAMBDA_FUNCTION);
#endif
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4)
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_ADD_TRAIT);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_BIND_TRAITS);
#endif
}

Expand Down

0 comments on commit 9da6d93

Please sign in to comment.