Anonymous | Login | Signup for a new account | 2018-04-25 05:42 BST | ![]() |
My View | View Issues | Change Log | Roadmap |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
0001405 | Xdebug | Code Coverage | public | 2017-03-10 12:44 | 2017-03-10 13:16 | ||||||||
Reporter | exussum | ||||||||||||
Assigned To | derick | ||||||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||||||
Status | resolved | Resolution | not fixable | ||||||||||
Platform | Linux | OS | Ubuntu | OS Version | 16.10 | ||||||||
Product Version | 2.5.1 | ||||||||||||
Target Version | Fixed in Version | ||||||||||||
Summary | 0001405: Continue is covered incorrectly | ||||||||||||
Description | xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); foreach([1,2] as $value) { if (false) { continue; } } $cc = xdebug_get_code_coverage(); ksort($cc); var_dump(array_slice($cc, 0, 1)); xdebug_stop_code_coverage(false); the var dump above should be empty as you cant run the continue (if false prevents it being run) Currently you get int(1) | ||||||||||||
Steps To Reproduce | Run the above script | ||||||||||||
Tags | No tags attached. | ||||||||||||
Operating System | |||||||||||||
PHP Version | 7.1.0-7.1.4 | ||||||||||||
Attached Files | ![]() | ||||||||||||
![]() |
|
(0004228) exussum (reporter) 2017-03-10 12:45 |
The copy paste was incorrect, use the file instead! sorry |
(0004229) derick (administrator) 2017-03-10 12:50 |
I can't reproduce this: derick@singlemalt:~ $ cat /tmp/1405.php <?php foreach([1,2] as $value) { if (false) { continue; } } $cc = xdebug_get_code_coverage(); ksort($cc); var_dump($cc); xdebug_stop_code_coverage(false); derick@singlemalt:~ $ php -v PHP 7.1.3-dev (cli) (built: Feb 21 2017 14:55:35) ( NTS DEBUG ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies with Xdebug v2.5.1, Copyright (c) 2002-2017, by Derick Rethans [PHP: 7.1.3-dev ] derick@singlemalt:~ $ php /tmp/1405.php /tmp/1405.php:10: array(0) { } [PHP: 7.1.3-dev ] |
(0004230) exussum (reporter) 2017-03-10 12:53 |
PHP 7.0.15-0ubuntu0.16.10.4 (cli) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.15-0ubuntu0.16.10.4, Copyright (c) 1999-2017, by Zend Technologies with Xdebug v2.6.0-dev, Copyright (c) 2002-2017, by Derick Rethans Is my version if you run the file rather than the code it should have been <?php xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); foreach([1,2] as $value) { if (false) { continue; } } $cc = xdebug_get_code_coverage(); ksort($cc); var_dump(current($cc)[7]); xdebug_stop_code_coverage(false); Which is in the file |
(0004231) exussum (reporter) 2017-03-10 12:54 |
scott@PC147:/tmp$ php -v PHP 7.0.15-0ubuntu0.16.10.4 (cli) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.15-0ubuntu0.16.10.4, Copyright (c) 1999-2017, by Zend Technologies with Xdebug v2.6.0-dev, Copyright (c) 2002-2017, by Derick Rethans scott@PC147:/tmp$ php broken.php /tmp/broken.php:14: int(1) scott@PC147:/tmp$ cat broken.php <?php xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); foreach([1,2] as $value) { if (false) { continue; } } $cc = xdebug_get_code_coverage(); ksort($cc); var_dump(current($cc)[7]); xdebug_stop_code_coverage(false); To follow a similar flow as yours |
(0004232) derick (administrator) 2017-03-10 13:16 |
OK, I can now reproduce this, but I can not fix it. PHP unfortunately doesn't reset the line numbers for some of the generated code: 6 9 > EXT_STMT 10 > JMPZ <false>, ->13 7 11 > EXT_STMT 12 > JMP ->8 13 > > JMP ->8 14 > FE_FREE $3 The JMP in line 12 (and line 13) is generated for line 7, and not 8. This is something that needs to be fixed in PHP itself: http://bugs.php.net [^] |
![]() |
|||
Date Modified | Username | Field | Change |
2017-03-10 12:44 | exussum | New Issue | |
2017-03-10 12:44 | exussum | File Added: broken.php | |
2017-03-10 12:45 | exussum | Note Added: 0004228 | |
2017-03-10 12:50 | derick | Note Added: 0004229 | |
2017-03-10 12:50 | derick | Assigned To | => derick |
2017-03-10 12:50 | derick | Status | new => feedback |
2017-03-10 12:53 | exussum | Note Added: 0004230 | |
2017-03-10 12:53 | exussum | Status | feedback => assigned |
2017-03-10 12:54 | exussum | Note Added: 0004231 | |
2017-03-10 13:16 | derick | Note Added: 0004232 | |
2017-03-10 13:16 | derick | Status | assigned => resolved |
2017-03-10 13:16 | derick | Resolution | open => not fixable |
Copyright © 2000 - 2018 MantisBT Team |