Skip to content

Commit

Permalink
- One more opcode for bug xdebug#651: Incorrect code coverage after e…
Browse files Browse the repository at this point in the history
…mpty() in

  conditional when using XDEBUG_CC_UNUSED.

SVN Rev: 3388
  • Loading branch information
derickr committed Jan 10, 2011
1 parent 5f1d6b9 commit 63959ef
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/bug00651.phpt
@@ -1,5 +1,5 @@
--TEST--
Test for bug #651: Incorrect code coverage after empty() in conditional
Test for bug #651: Incorrect code coverage after ! empty() in conditional
--FILE--
<?php

Expand Down
62 changes: 62 additions & 0 deletions tests/bug00651b.phpt
@@ -0,0 +1,62 @@
--TEST--
Test for bug #651: Incorrect code coverage after empty() in conditional
--FILE--
<?php

xdebug_start_code_coverage(XDEBUG_CC_UNUSED);

function repeat($x)
{
if ( empty($x)
AND $x !== 1
AND $x !== 2
AND $x !== 3)
{
$y = 'covered';
}
}

repeat(0);
repeat(1);
repeat(2);
repeat(3);
repeat(4);

var_dump(xdebug_get_code_coverage());
?>
--EXPECTF--
array(1) {
["%sbug00651b.php"]=>
array(15) {
[5]=>
int(1)
[7]=>
int(1)
[8]=>
int(1)
[9]=>
int(1)
[10]=>
int(1)
[11]=>
int(1)
[12]=>
int(1)
[13]=>
int(1)
[14]=>
int(1)
[16]=>
int(1)
[17]=>
int(1)
[18]=>
int(1)
[19]=>
int(1)
[20]=>
int(1)
[22]=>
int(1)
}
}
62 changes: 62 additions & 0 deletions tests/bug00651c.phpt
@@ -0,0 +1,62 @@
--TEST--
Test for bug #651: Incorrect code coverage after isset() in conditional
--FILE--
<?php

xdebug_start_code_coverage(XDEBUG_CC_UNUSED);

function repeat($x)
{
if ( isset($x)
AND $x !== 1
AND $x !== 2
AND $x !== 3)
{
$y = 'covered';
}
}

repeat(0);
repeat(1);
repeat(2);
repeat(3);
repeat(4);

var_dump(xdebug_get_code_coverage());
?>
--EXPECTF--
array(1) {
["%sbug00651c.php"]=>
array(15) {
[5]=>
int(1)
[7]=>
int(1)
[8]=>
int(1)
[9]=>
int(1)
[10]=>
int(1)
[11]=>
int(1)
[12]=>
int(1)
[13]=>
int(1)
[14]=>
int(1)
[16]=>
int(1)
[17]=>
int(1)
[18]=>
int(1)
[19]=>
int(1)
[20]=>
int(1)
[22]=>
int(1)
}
}
1 change: 1 addition & 0 deletions xdebug.c
Expand Up @@ -512,6 +512,7 @@ PHP_MINIT_FUNCTION(xdebug)
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_JMP);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_JMPZ);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_JMPNZ);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_JMPZ_EX);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_IDENTICAL);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_NOT_IDENTICAL);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_EQUAL);
Expand Down

0 comments on commit 63959ef

Please sign in to comment.