php.net |  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: -
Votes:1
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.
Password:
Status:
Package:
Bug Type:
Summary:
From: gadelat at gmail dot com
New email:
PHP Version: OS:

 

 [2018-12-28 18:00 UTC] gadelat at gmail dot com
Description:
------------
Might be duplicate of https://bugs.php.net/bug.php?id=67105 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/

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

<?php

$stream = tmpfile();

pcntl_async_signals(true);
pcntl_signal(SIGINT, function() {
	exit(0);
});

while(true);
 [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 Jun 27 08:01:40 2019 UTC