View Issue Details

IDProjectCategoryView StatusLast Update
0001686XdebugUsage problems (Wrong Results)public2019-07-22 18:02
Reporterdennis-fedcoAssigned Toderick 
PrioritynormalSeveritycrashReproducibilityalways
Status assignedResolutionopen 
PlatformWindowsOSMicrosoft Windows 10 Pro OS Version1809
Product Version2.7.2 
Target VersionFixed in Version 
Summary0001686: PHPUnit Test that uses certain Prophecy methods causes a segfault
DescriptionPHPUnit Test that uses certain Prophecy methods and/or parameters causes a segfault
Steps To ReproduceSee https://stackoverflow.com/questions/57097956/why-does-my-phpunit-test-causes-segfault-with-prophecy-mocks-when-xdebug-is-enab

Unit Test causes a segfault ONLY when Xdebug is enabled. Segfault stops when XDebug is disabled

declare(strict_types = 1);
namespace AppTest\Handler;

use PHPUnit\Framework\TestCase;

class XXX
{
    public function has($id)
    {
        return true;
    }
}

class MyTest extends TestCase
{
    public function testFactoryWithoutTemplate()
    {
        $container = $this->prophesize(XXX::class);

        // This line causes SEGFAULT:
        $container->has(7)->willReturn(false);
    }
}

SegFault
=======

PHPUnit 8.2.5 by Sebastian Bergmann and contributors.

vendor/bin/phpunit: line 10: 19828 Segmentation fault "${dir}/phpunit" "$@"
Additional InformationPHP 7.3.7 (cli) (built: Jul 3 2019 14:34:13) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.7, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans

Server version: Apache/2.4.38 (Win64)
Apache Lounge VC15 Server built: Jan 18 2019 14:26:34




Options:

zend_extension = "C:\php\ext\php_xdebug-2.7.2-7.3-vc15-x86_64.dll"
xdebug.default_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\Users\dmatveyev\Documents\callgrind"
xdebug.profiler_output_name = callgrind.out.%p.%u
xdebug.trace_options = 1
xdebug.collect_params = 4
xdebug.collect_return = 1
xdebug.scream = 1
xdebug.trace_format = 1
xdebug.trace_options = 1
xdebug.profiler_append = 1


Either xdebug.default_enable = 1 OR xdebug.profiler_enable_trigger = 1
cause the segfault.
TagsPHP7
Operating Systemwindows 10
PHP Version7.3.5-7.3.9

Activities

dennis-fedco

2019-07-18 20:43

reporter   ~0005070

update actually only the xdebug.default_enable directive being 1 seems to be causing the segfault

xdebug.profiler_enable_trigger =1 was causing the issue for PHP 7.3.2
It does not seems to cause the issue for PHP 7.3.9

derick

2019-07-19 11:38

administrator   ~0005072

Could you make a tarball with everything, including instructions (what you installed, how you ran it), that I need to test this out? The smaller the better.

dennis-fedco

2019-07-22 18:02

reporter   ~0005086

Alas, I don't know what I did (and I did nothing of significance that I can point at & didn't reboot since segfault)
but the test now works and there is no segfault.

I will keep an eye out if it happens again, but for now you can probably close this issue.

Issue History

Date Modified Username Field Change
2019-07-18 20:33 dennis-fedco New Issue
2019-07-18 20:33 dennis-fedco Tag Attached: PHP7
2019-07-18 20:43 dennis-fedco Note Added: 0005070
2019-07-19 11:38 derick Assigned To => derick
2019-07-19 11:38 derick Status new => feedback
2019-07-19 11:38 derick Note Added: 0005072
2019-07-22 18:02 dennis-fedco Note Added: 0005086
2019-07-22 18:02 dennis-fedco Status feedback => assigned