Skip to content

[bug] 非预期的 proc_close hook #243

@BadJacky

Description

@BadJacky

Describe the bug / 问题描述
proc_close 会关闭多个管道,而不是预期内的当前资源。

To Reproduce / 如何复现
php8.3.7 ,composer 2.7.6

  • 安装 Laravel 最新版本
  • 执行 php artisan vendor:publish
  • 选中任意一个 provider 发布
  • 得到错误
    CleanShot 2024-05-11 at 15 05 00@2x

Expected behavior / 正确的行为
ServiceProvider 可以预期内的发布。
CleanShot 2024-05-11 at 15 43 44@2x

Outputs / 程序输出
可见错误图片中的 debug 内容

Runtime Environment / 运行环境

OS:

Darwin bogon 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:37 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6031 arm64
PHP 8.3.7 (cli) (built: May  7 2024 16:35:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.7, Copyright (c) Zend Technologies
    with Xdebug v3.3.1, Copyright (c) 2002-2023, by Derick Rethans
    with Zend OPcache v8.3.7, Copyright (c), by Zend Technologies

Swow: 1.5.0 ( NTS DEBUG )

Additional context / 补充说明
在之前版本并为使用过此命令,无法提供是否在之前版本也会受到影响。
在简单读了 swow hook proc_close 的函数后,得到简单结论
swow_proc_open_rsrc_close 函数会直接影响 proc_close 的预期行为,直接关闭了多个管道,看起来这是一个预期之外的 hook。

static int swow_proc_open_rsrc_close(php_process_handle *proc)
{
//......
    /* Close all handles to avoid a deadlock 读起来是为了避免死锁而做的操作,但是这里直接影响了预期内的行为。*/
    for (int i = 0; i < proc->npipes; i++) {
        if (proc->pipes[i] != NULL) {
            GC_DELREF(proc->pipes[i]);
            zend_list_close(proc->pipes[i]);
            proc->pipes[i] = NULL;
        }
    }
}
//......

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions