View Issue Details

IDProjectCategoryView StatusLast Update
0002283XdebugCode Coveragepublic2024-11-28 13:41
Reportereasteregg Assigned Toderick  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.3.2 
Target Version3.3devFixed in Version3.4.0 
Summary0002283: SoapClient usage causes segfault with codecoverage
Description

using the soapclient like this:

    // we fake the soap client to return our prerecorded xml response and have it decoded via the SoapClient
    $client = new class ( __DIR__ . '/StationList.wsdl', ['trace' => true]) extends SoapClient {
        public function __doRequest(string $request, string $location, string $action, int $version, bool $oneWay = false): string
        {
            return \file_get_contents(__DIR__ . '/Result.xml') ?: throw new RuntimeException('missing PointListRequestResult');
        }
    };

    $client->getTheStationListFull();

will cause a segfault, see provided github repository for a small reproducer.

(gdb) bt
#0 call_end_observers (return_value=0x0, execute_data=0x5574df430000) at ./Zend/zend_observer.c:265
#1 zend_observer_fcall_end_all () at ./Zend/zend_observer.c:293
0000002 0x00005574eae024d9 in php_request_shutdown (dummy=dummy@entry=0x0) at ./main/main.c:1849
0000003 0x00005574eaf59ace in do_cli (argc=3, argv=0x5574f7a43520) at ./sapi/cli/php_cli.c:1136
0000004 0x00005574eac959c6 in main (argc=3, argv=0x5574f7a43520) at ./sapi/cli/php_cli.c:1340

full backtrace here: https://github.com/verfriemelt-dot-org/xdebug-soap-segfault/blob/main/backtrace.log

Steps To Reproduce

see https://github.com/verfriemelt-dot-org/xdebug-soap-segfault

Additional Information

$ php -v
PHP 8.3.9 (cli) (built: Jul 8 2024 10:28:34) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.9, Copyright (c) Zend Technologies
with Xdebug v3.3.2, Copyright (c) 2002-2024, by Derick Rethans
with Zend OPcache v8.3.9, Copyright (c), by Zend Technologies

TagsNo tags attached.
Operating System
PHP Version8.3.5-8.3.9

Activities

derick

2024-08-07 13:31

administrator   ~0007031

I can reproduce this, but I haven't managed to find out why this happens yet.

I did manage to reduce your test case to even smaller - without having to use PHPUnit at all:

$ cat test.php 
<?php
require_once __DIR__ . '/src/Foo.php';

$foo = new Foo();
?>

And running it with:

php -n -dzend_extension=xdebug -dxdebug.mode=develop test.php

Code coverage does also not need to be enabled.

easteregg

2024-09-01 18:45

reporter   ~0007048

just as an FYI, as of now, i found a viable workaround:

#[RunClassInSeparateProcess]

on my test does not trigger the crash shrug no idea why, but yeah

derick

2024-10-08 15:22

administrator   ~0007063

This is likely caused by a bug in PHP (https://github.com/php/php-src/pull/16252), which should get fixed in the next PHP 8.2/8.3/8.4 releases.

derick

2024-11-27 16:02

administrator   ~0007092

Can you still reproduce this with PHP 8.3.14?

easteregg

2024-11-27 16:43

reporter   ~0007100

uh, nice in fact it seems to be resolved :)

easteregg

2024-11-27 16:44

reporter   ~0007101

$ make
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text

Warning: JIT is incompatible with third party extensions that override zend_execute_ex(). JIT disabled. in Unknown on line 0
PHPUnit 11.2.8 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.14 with Xdebug 3.3.2
Configuration: /home/easteregg/src/xdebug-soap/phpunit.dist.xml

R                                                                   1 / 1 (100%)

Time: 00:00.046, Memory: 8.00 MB

There was 1 risky test:

1) Test::test
This test did not perform any assertions

/home/easteregg/src/xdebug-soap/tests/Test.php:12

OK, but there were issues!
Tests: 1, Assertions: 0, Risky: 1.

Code Coverage Report:
  2024-11-27 16:43:03

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/1)
  Lines:    0.00% (0/4)

no segfault anymore :)

derick

2024-11-28 13:15

administrator   ~0007107

Thanks for letting me know. I'll close this then.

Issue History

Date Modified Username Field Change
2024-07-29 07:33 easteregg New Issue
2024-08-07 13:31 derick Assigned To => derick
2024-08-07 13:31 derick Status new => confirmed
2024-08-07 13:31 derick Note Added: 0007031
2024-08-07 13:32 derick Target Version => 3.3dev
2024-09-01 18:45 easteregg Note Added: 0007048
2024-10-08 15:22 derick Note Added: 0007063
2024-11-27 16:02 derick Status confirmed => feedback
2024-11-27 16:02 derick Note Added: 0007092
2024-11-27 16:43 easteregg Note Added: 0007100
2024-11-27 16:43 easteregg Status feedback => assigned
2024-11-27 16:44 easteregg Note Added: 0007101
2024-11-28 13:15 derick Status assigned => resolved
2024-11-28 13:15 derick Resolution open => fixed
2024-11-28 13:15 derick Fixed in Version => 3.4dev
2024-11-28 13:15 derick Note Added: 0007107
2024-11-28 13:41 derick Fixed in Version 3.4dev => 3.4.0