|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
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-2020 The PHP Group
All rights reserved.
Last updated: Tue Oct 20 15:01:25 2020 UTC