Platform
macOS
Operating system version
macOs Tahoe 26.3.1
System architecture
ARM64 (M1, M2, etc)
Herd Version
1.28.0
PHP Version
PHP 8.5.4
Bug description
With phpunit 12.5.16 and Herd 1.28.0
Tests that have:
#[RunTestsInSeparateProcesses]
#[PreserveGlobalState(true)]
Give this warning: Global variable $GLOBALS['__herd_closure'] was not preserved because it is a Closure.
When i remove #[PreserveGlobalState(true)] it will work without problems.
Steps to reproduce
<?php
namespace Tests\Unit;
use PHPUnit\Framework\Attributes\PreserveGlobalState;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use PHPUnit\Framework\TestCase;
#[RunTestsInSeparateProcesses]
#[PreserveGlobalState(true)]
class ExampleTest extends TestCase
{
public function test_that_true_is_true(): void
{
$this->assertTrue(true);
}
}
Gives:
WARN Tests\Unit\ExampleTest
! that true is true → Global variable $GLOBALS['__herd_closure'] was not preserved because it is a Closure
Relevant log output
Platform
macOS
Operating system version
macOs Tahoe 26.3.1
System architecture
ARM64 (M1, M2, etc)
Herd Version
1.28.0
PHP Version
PHP 8.5.4
Bug description
With phpunit
12.5.16and Herd1.28.0Tests that have:
Give this warning:
Global variable $GLOBALS['__herd_closure'] was not preserved because it is a Closure.When i remove
#[PreserveGlobalState(true)]it will work without problems.Steps to reproduce
Gives:
Relevant log output