php / php/php-src

allow ini_set('error_log',...) with in-memory stream

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

还没有人认领这个 Issue。

Category: Streams Feature Status: Needs Triage
主要语言
C
星标
40.4k
派生
8.2k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

Description

calling ini_set('error_log', $logger) seems to expect $logger to be a filesystem path (or a magic identifer like "syslog").

is it possible to pass in a memory stream?

use-case: in phpunit we want to capture all output a possible code beeing tested might write into error_log.
I have implemented this feature with a tmpfile() in https://github.com/sebastianbergmann/phpunit/pull/6118 but IMO it would be cleaner and more efficient (no filesystem IO) if I could pass in a memory stream like php://memory or php://temp:

        $stream = fopen('php://temp', 'rw');
        $errorLogPrevious = ini_set('error_log', $stream);

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先跟踪 ini_set('error_log', ...) 如何处理文件系统路径以及 "syslog" 等魔法标识符。查看链接的 PHPUnit pull request,了解当前针对 tmpfile() 的 workaround,并定义对 php://memory 或 php://temp 的支持行为,包括如何验证完成情况。

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

评估

技术栈
php
领域
backend
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

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