[xdebug-dev] svn: /xdebug/trunk/ tests/bug00697.inc tests/bug00697.phpt xdebug.c

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Sun, 29 May 2011 18:08:14 +0000

derick Sun, 29 May 2011 18:08:13 +0000

Revision: http://svn.xdebug.org/cgi-bin/viewvc.cgi?view=rev&revision=3442&root=xdebug

Log:
- Fixed bug #697: Incorrect code coverage of function arguments when using XDEBUG_CC_UNUSED

Changed paths:
    A xdebug/trunk/tests/bug00697.inc
    A xdebug/trunk/tests/bug00697.phpt
    U xdebug/trunk/xdebug.c

Added: xdebug/trunk/tests/bug00697.inc
===================================================================
--- xdebug/trunk/tests/bug00697.inc (rev 0)
+++ xdebug/trunk/tests/bug00697.inc 2011-05-29 18:08:13 UTC (rev 3442)
@@ -0,0 +1,9 @@
+<?php
+function test()
+{
+ substr('', 2,
+ 0 + 3 + 0
+ );
+}
+
+test();

Added: xdebug/trunk/tests/bug00697.phpt
===================================================================
--- xdebug/trunk/tests/bug00697.phpt (rev 0)
+++ xdebug/trunk/tests/bug00697.phpt 2011-05-29 18:08:13 UTC (rev 3442)
@@ -0,0 +1,50 @@
+--TEST--
+Test for bug #697: Incorrect code coverage of function arguments when using XDEBUG_CC_UNUSED.
+--SKIPIF--
+<?php if (!extension_loaded("xdebug")) print "skip"; ?>
+--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
+--FILE--
+<?php
+ xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
+
+ include 'bug00697.inc';
+ $cc = xdebug_get_code_coverage();
+ ksort($cc);
+ var_dump(array_slice($cc, 0, 1));
+
+ xdebug_stop_code_coverage(false);
+?>
+--EXPECTF--
+array(1) {
+ ["%sbug00697.inc"]=>
+ array(7) {
+ [2]=>
+ int(1)
+ [4]=>
+ int(1)
+ [5]=>
+ int(1)
+ [6]=>
+ int(1)
+ [7]=>
+ int(1)
+ [9]=>
+ int(1)
+ [10]=>
+ int(1)
+ }
+}

Modified: xdebug/trunk/xdebug.c
===================================================================
--- xdebug/trunk/xdebug.c 2011-05-27 02:22:45 UTC (rev 3441)
+++ xdebug/trunk/xdebug.c 2011-05-29 18:08:13 UTC (rev 3442)
@@ -553,6 +553,11 @@
                 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);
+ XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_SUB);
+ XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_MUL);
+ XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_DIV);
+
                 XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_ADD_ARRAY_ELEMENT);
                 XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_RETURN);
                 XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_EXT_STMT);
Received on Sun May 29 2011 - 19:08:14 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST