|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77365 tmpfile() is not being cleaned up
Submitted: 2018-12-28 18:00 UTC Modified: -
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: gadelat at gmail dot com Assigned:
Status: Open Package: Filesystem function related
PHP Version: 7.2.14RC1 OS: Ubuntu 18.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: gadelat at gmail dot com
New email:
PHP Version: OS:


 [2018-12-28 18:00 UTC] gadelat at gmail dot com
Might be duplicate of but created this issue anyway, since that report wasn't acknowledged and aims for documentation instead of fixing the cleanup process.

Anyway, bug is that interrupting script via CTRL+C prevents tmpfile cleanup.

Test script:
tmpfile(); while(true) // execute this and press ctrl+c

Expected result:
no new php* files in /tmp/

Actual result:
new php* file in /tmp/


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-12-30 00:01 UTC] gadelat at gmail dot com
Just found that following for some reason DOES delete the file


$stream = tmpfile();

pcntl_signal(SIGINT, function() {

 [2018-12-30 09:33 UTC] gadelat at gmail dot com
There is no way in PHP to clean up tmpfiles when script is terminated with ctrl+c in cross platform compatible way :(
 [2018-12-30 14:28 UTC] spam2 at rhsoft dot net
ctrl+c = sigterm and so why should there be no way?
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Sep 16 10:01:36 2019 UTC