Skip to content

Improvement of php://temp to add automatically prefix for debugging #20530

@antoinetran

Description

@antoinetran

Description

Hi,

Any php code that uses temporary files uses fopen("php://temp", "w") a lot. This function does not allow putting prefix or suffix like tempnam() . And because the first expression also deletes the file automatically at file closure, it is much more convenient.

So in the end, with a big application and lots of dependencies, there are many many temporary files in /tmp/php*. When debugging the source of these files, for example to know why there are big files, it is very difficult, and requires reading source code of the app and its dependencies, and then changing to tempnam() with a prefix, which also requires manual deleting.

Instead, is-it possible to automatically add as prefix the php file name? Example:
S3Upload.php => the fopen would generate in Linux something like /tmp/php-S3Upload.php-DOoeG

I don't think there are any negative impact, I guess?

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