|  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
31 - 24 = ?
Subscribe to this entry?

 [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: Thu Nov 14 19:01:35 2019 UTC