Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions sapi/fpm/tests/response.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ namespace FPM;
abstract class BaseResponse
{
/**
* Tester instance
* @var Tester
* Tester instance. Held weakly so that responses do not form a reference
* cycle with the tester, which would keep both alive until the executor
* object store shutdown and get reported as a leak by ASAN/Valgrind.
* @var \WeakReference<Tester>
*/
private Tester $tester;
private \WeakReference $tester;

/**
* @var bool
Expand All @@ -20,7 +22,7 @@ abstract class BaseResponse
*/
public function __construct(Tester $tester)
{
$this->tester = $tester;
$this->tester = \WeakReference::create($tester);
}

/**
Expand Down Expand Up @@ -50,7 +52,7 @@ abstract class BaseResponse
}
echo $errorMessage;

$this->tester->printLogs();
$this->tester->get()?->printLogs();

return false;
}
Expand Down
2 changes: 1 addition & 1 deletion sapi/fpm/tests/tester.inc
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ class Tester

$this->masterProcess = proc_open($cmd, $desc, $pipes, null, $envVars);
register_shutdown_function(
function ($masterProcess) use ($configFile) {
static function ($masterProcess) use ($configFile) {
@unlink($configFile);
if (is_resource($masterProcess)) {
@proc_terminate($masterProcess);
Expand Down
Loading