Improvement of php://temp to add automatically prefix for debugging
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the fopen("php://temp") entry point and compare its behavior with tempnam(), especially how files under /tmp/php* are created and removed. Define the desired prefix semantics and verify that generated names improve debugging while automatic deletion remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100