View Issue Details

IDProjectCategoryView StatusLast Update
0002283XdebugCode Coveragepublic2024-09-01 18:45
Reportereasteregg Assigned Toderick  
PrioritynormalSeveritycrashReproducibilityalways
Status confirmedResolutionopen 
Product Version3.3.2 
Target Version3.3dev 
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

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