Permalink
Browse files

Fixed issue #1502: SEND_REF lines are not marked as covered

  • Loading branch information...
derickr committed Dec 11, 2017
1 parent cf4530f commit aafa6688a1ca48821edc6fdd871e94ce06161f8d
Showing with 64 additions and 0 deletions.
  1. +22 −0 tests/bug01502.inc
  2. +40 −0 tests/bug01502.phpt
  3. +2 −0 xdebug.c
View
@@ -0,0 +1,22 @@
<?php
class Foo
{
public function sort($array)
{
usort(
$array,
function ($x, $y) { return true; }
);
\usort(
$array,
function ($x, $y) { return true; }
);
return $array;
}
}
?>
View
@@ -0,0 +1,40 @@
--TEST--
Test for bug #1502: SEND_REF lines are not marked as covered.
--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 | XDEBUG_CC_DEAD_CODE);
include 'bug01502.inc';
$f = new Foo;
$f->sort( [ 5, 2, 5 ] );
$cc = xdebug_get_code_coverage();
ksort($cc);
$result = current(array_slice($cc, 0, 1));
echo "Line 10 covered: ", $result[10] == 1 ? "yes" : "no", "\n";
echo "Line 15 covered: ", $result[15] == 1 ? "yes" : "no", "\n";
xdebug_stop_code_coverage(false);
?>
--EXPECTF--
Line 10 covered: yes
Line 15 covered: yes
View
@@ -733,6 +733,7 @@ PHP_MINIT_FUNCTION(xdebug)
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_EXT_STMT);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_SEND_VAR);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_SEND_VAR_NO_REF);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_SEND_REF);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_SEND_VAL);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_SEND_VAL_EX);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_SEND_VAR_EX);
@@ -893,6 +894,7 @@ PHP_MSHUTDOWN_FUNCTION(xdebug)
zend_set_user_opcode_handler(ZEND_EXT_STMT, NULL);
zend_set_user_opcode_handler(ZEND_SEND_VAR, NULL);
zend_set_user_opcode_handler(ZEND_SEND_VAR_NO_REF, NULL);
zend_set_user_opcode_handler(ZEND_SEND_REF, NULL);
zend_set_user_opcode_handler(ZEND_SEND_VAL, NULL);
zend_set_user_opcode_handler(ZEND_SEND_VAL_EX, NULL);
zend_set_user_opcode_handler(ZEND_SEND_VAR_EX, NULL);

0 comments on commit aafa668

Please sign in to comment.