View Issue Details

IDProjectCategoryView StatusLast Update
0001992XdebugCode Coveragepublic2021-10-04 09:32
ReporterComiR Assigned Toderick  
PriorityhighSeveritycrashReproducibilityalways
Status closedResolutionfixed 
PlatformMacBook ProOSMacOSOS Version10.15.7
Product Version3.0.4 
Target Version3.1devFixed in Version3.1.0 
Summary0001992: Code Coverage with filter produces Segmentation fault on xdebug_stop_code_coverage()
Description

Xdebug throws a Segmentation fault when xdebug_stop_code_coverage() is called, but nothing was covered.
I tracked it down to the call to this function while debugging the PhpUnit test.

php -v
PHP 7.4.21 (cli) (built: Jul  1 2021 19:30:38) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.21, Copyright (c), by Zend Technologies
    with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
Steps To Reproduce
  • extract attached file
  • composer install
  • ./vendor/bin/phpunit --prepend xdebug-filter.php
  • See segmentation fault happening:
    
    ./vendor/bin/phpunit --prepend xdebug-filter.php --debug
    PHPUnit 9.5.6 by Sebastian Bergmann and contributors.

Test 'Foo\Tests\BarTest::testNothing' started
Segmentation fault

Additional Information

The segfault also occured in php 7.4.20, Xdebug 3.0.2 and also with PHPUnit 7.5.20 (with appropriate phpunit.xml).

I ran the tests in a php docker container based on buster.

TagsNo tags attached.
Attached Files
foo.zip (10,143 bytes)
Operating System
PHP Version7.4.10-7.4.19

Activities

derick

2021-07-12 17:44

administrator   ~0005921

I can reproduce this, and much easier as well:

derick@gargleblaster:/tmp/1992$ cat test.php
<?php
xdebug_start_code_coverage();
xdebug_stop_code_coverage(true);

derick@gargleblaster:/tmp/1992$ cat filter.php
<?php
xdebug_set_filter(XDEBUG_FILTER_CODE_COVERAGE, XDEBUG_PATH_INCLUDE, ['src/']);

derick@gargleblaster:/tmp/1992$ php -dxdebug.mode=coverage -dauto_prepend_file=filter.php test.php
Segmentation fault

derick

2021-07-14 10:28

administrator   ~0005922

https://github.com/xdebug/xdebug/pull/757

Issue History

Date Modified Username Field Change
2021-07-08 18:35 ComiR New Issue
2021-07-08 18:35 ComiR File Added: foo.zip
2021-07-12 17:44 derick Assigned To => derick
2021-07-12 17:44 derick Status new => confirmed
2021-07-12 17:44 derick Note Added: 0005921
2021-07-12 17:44 derick Target Version => 3.1dev
2021-07-12 17:44 derick Description Updated
2021-07-12 17:44 derick Steps to Reproduce Updated
2021-07-12 17:44 derick Additional Information Updated
2021-07-14 10:28 derick Note Added: 0005922
2021-07-14 10:29 derick Status confirmed => closed
2021-07-14 10:29 derick Resolution open => fixed
2021-07-14 10:29 derick Fixed in Version => 3.1dev
2021-09-05 16:15 derick Fixed in Version 3.1dev => 3.1.0beta1
2021-10-04 09:32 derick Fixed in Version 3.1.0beta1 => 3.1.0