[php-src] Issue #20530: Improvement of php://temp to add automatically prefix for debugging
| From: | antoinetran | Date: | Wed, 19 Nov 2025 16:32:56 +0000 |
| Subject: | [php-src] Issue #20530: Improvement of php://temp to add automatically prefix for debugging | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251250@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20530
Author: 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?