Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: [macOS] php 8.5 & phpunit process isolation gives serialisation error

未关闭
#1,674 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
macos, php

调研方向

在 macOS Tahoe 上使用 Herd 1.28.0、PHP 8.5.4 和 PHPUnit 12.5.16,从提供的 Tests\Unit\ExampleTest 复现开始;比较使用 PreserveGlobalState(true) 和不使用它时的行为。完成标准是:进程隔离的测试能够保留相关的全局状态,且不会出现 __herd_closure 序列化警告。

由索引模型根据 Issue 内容生成。

描述

macOS
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

主要语言
没有语言数据
星标
124
派生
1
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

beyondcode/herd-community 的其他 Issue

查看 beyondcode/herd-community 的全部 Issue

相似的 Issue

更多 Operating Systems Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。