Skip to content

PHPUnit internal error #5549

@hbrecht

Description

@hbrecht
Q A
PHPUnit version 10.4.1 / 10.4.2
PHP version PHP 8.2.7 with PCOV 1.0.11
Installation Method PHAR

Summary

When running our test suite, after ~3000 tests the program stops with an internal error.

Current behavior

When running our test suite, suddenly below error occurs. There were only some code changes done in the code being tested; it was running on 10.4.1 this morning. Update to 10.4.2 does not help. Here is the complete error:

An error occurred inside PHPUnit.

Message: PHPUnit\Event\Telemetry\HRTime::duration(): Argument #1 ($start) must be of type PHPUnit\Event\Telemetry\HRTime, null given, called in phar:///usr/local/bin/phpunit/phpunit/Logging/JUnit/JunitXmlLogger.php on line 191

Location: phar:///usr/local/bin/phpunit/phpunit/TextUI/TestRunner.php:48

#0 phar:///usr/local/bin/phpunit/phpunit/TextUI/Application.php(144): PHPUnit\TextUI\TestRunner->run()
#1 /usr/local/bin/phpunit(2976): PHPUnit\TextUI\Application->run()
#2 {main}

Caused by: phar:///usr/local/bin/phpunit/phpunit/Event/Value/Telemetry/HRTime.php:54

#0 phar:///usr/local/bin/phpunit/phpunit/Logging/JUnit/JunitXmlLogger.php(191): PHPUnit\Event\Telemetry\HRTime->duration()
#1 phar:///usr/local/bin/phpunit/phpunit/Logging/JUnit/JunitXmlLogger.php(148): PHPUnit\Logging\JUnit\JunitXmlLogger->handleFinish()
#2 phar:///usr/local/bin/phpunit/phpunit/Logging/JUnit/Subscriber/TestFinishedSubscriber.php(29): PHPUnit\Logging\JUnit\JunitXmlLogger->testFinished()
#3 phar:///usr/local/bin/phpunit/phpunit/Event/Dispatcher/DirectDispatcher.php(78): PHPUnit\Logging\JUnit\TestFinishedSubscriber->notify()
#4 phar:///usr/local/bin/phpunit/phpunit/Event/Dispatcher/DeferringDispatcher.php(41): PHPUnit\Event\DirectDispatcher->dispatch()
#5 phar:///usr/local/bin/phpunit/phpunit/Event/Emitter/DispatchingEmitter.php(548): PHPUnit\Event\DeferringDispatcher->dispatch()
#6 phar:///usr/local/bin/phpunit/phpunit/Framework/TestRunner.php(152): PHPUnit\Event\DispatchingEmitter->testFinished()
#7 phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php(436): PHPUnit\Framework\TestRunner->run()
#8 phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php(266): PHPUnit\Framework\TestCase->run()
#9 phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php(266): PHPUnit\Framework\TestSuite->run()
#10 phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php(266): PHPUnit\Framework\TestSuite->run()
#11 phar:///usr/local/bin/phpunit/phpunit/TextUI/TestRunner.php(44): PHPUnit\Framework\TestSuite->run()
#12 phar:///usr/local/bin/phpunit/phpunit/TextUI/Application.php(144): PHPUnit\TextUI\TestRunner->run()
#13 /usr/local/bin/phpunit(2976): PHPUnit\TextUI\Application->run()
#14 {main}

How to reproduce

I do not have a way to reproduce this with a small example. However, since it is a type error, I would hope it might be possible to find it while analysing the code. I looked at the code and I see that there is an assert before, but it is most likely disabled.

Expected behavior

PHPUnit runs without internal error

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature/loggingIssues related to logging test resultsfeature/logging/junitIssues related to logging test results in JUnit XML formatfeature/test-runnerCLI test runnertype/bugSomething is brokenversion/10Something affects PHPUnit 10

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions