sebastianbergmann / phpunit

The PHP Unit Testing framework.

Home Page:https://phpunit.de/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Newrelic causes error handlers loop to get stuck, tests run out of memory

janfejtek opened this issue · comments

Q A
PHPUnit version 11.1.0
PHP version 8.2
Installation Method Composer

Summary

Library does not work on php with newrelic extension

Current behavior

When running test with php that contains newrelic extension, we get out of memory error. Loop here gets stuck

private function getActiveErrorHandlers(): array
{
$res = [];
while (true) {
$previousHandler = set_error_handler(static fn () => false);
restore_error_handler();
if ($previousHandler === null) {
break;
}
$res[] = $previousHandler;
restore_error_handler();
}
$res = array_reverse($res);
foreach ($res as $handler) {
set_error_handler($handler);
}
return $res;
}

How to reproduce

Expected behavior

There was similar issue in Symfony - symfony/symfony#25774 . Used fix is here https://github.com/symfony/symfony/pull/25755/files

Thank you for your report.

Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.

Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.

@mvorisek What do you think?

OP needs to provide minimal repro.

(also note the mentioned Symfony issue is from 2018, ie. quite unreleated)