php / php/php-src

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

オープン
#20,530 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Category: Streams Feature
主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

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?

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

fopen("php://temp") のエントリポイントから始め、tempnam() と動作を比較します。特に、/tmp/php* 配下のファイルがどのように作成および削除されるかを確認します。望ましいプレフィックスのセマンティクスを定義し、生成された名前によってデバッグ性が向上しつつ、自動削除が維持されることを検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, php
領域
backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。