php / php/php-src

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

Open
#17,817 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Category: Streams Feature Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

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);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how ini_set('error_log', ...) handles filesystem paths and magic identifiers such as "syslog". Review the linked PHPUnit pull request for the current tmpfile() workaround and define the supported behavior for php://memory or php://temp, including how completion would be verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.