Skip to content

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

Open
@staabm

Description

@staabm

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 sebastianbergmann/phpunit#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);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions