derick Fri, 07 Jan 2011 23:52:12 +0000
Revision: http://svn.xdebug.org/cgi-bin/viewvc.cgi?view=rev&revision=3385&root=xdebug
Log:
- Fixed bug #651: Incorrect code coverage after empty() in conditional.
Changed paths:
A xdebug/branches/xdebug_2_1/tests/bug00651.phpt
U xdebug/branches/xdebug_2_1/xdebug.c
A xdebug/trunk/tests/bug00651.phpt
U xdebug/trunk/xdebug.c
Added: xdebug/branches/xdebug_2_1/tests/bug00651.phpt
===================================================================
--- xdebug/branches/xdebug_2_1/tests/bug00651.phpt (rev 0)
+++ xdebug/branches/xdebug_2_1/tests/bug00651.phpt 2011-01-07 23:52:12 UTC (rev 3385)
@@ -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) {
+ ["%sbug00651.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)
+ }
+}
Modified: xdebug/branches/xdebug_2_1/xdebug.c
===================================================================
--- xdebug/branches/xdebug_2_1/xdebug.c 2011-01-07 23:52:11 UTC (rev 3384)
+++ xdebug/branches/xdebug_2_1/xdebug.c 2011-01-07 23:52:12 UTC (rev 3385)
@@ -518,6 +518,7 @@
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_NOT_EQUAL);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_SMALLER);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_SMALLER_OR_EQUAL);
+ XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_BOOL_NOT);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_ADD_ARRAY_ELEMENT);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_RETURN);
Added: xdebug/trunk/tests/bug00651.phpt
===================================================================
--- xdebug/trunk/tests/bug00651.phpt (rev 0)
+++ xdebug/trunk/tests/bug00651.phpt 2011-01-07 23:52:12 UTC (rev 3385)
@@ -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) {
+ ["%sbug00651.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)
+ }
+}
Modified: xdebug/trunk/xdebug.c
===================================================================
--- xdebug/trunk/xdebug.c 2011-01-07 23:52:11 UTC (rev 3384)
+++ xdebug/trunk/xdebug.c 2011-01-07 23:52:12 UTC (rev 3385)
@@ -547,6 +547,7 @@
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_NOT_EQUAL);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_SMALLER);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_SMALLER_OR_EQUAL);
+ XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_BOOL_NOT);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_ADD_ARRAY_ELEMENT);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_RETURN);
Received on Fri Jan 07 2011 - 23:52:12 GMT
This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST