Doc #66014 [Asn->Csd]: tmpfile() file deleted prematurely
| From: | aharvey@php.net | Date: | Fri, 01 Nov 2013 00:48:35 +0000 |
| Subject: | Doc #66014 [Asn->Csd]: tmpfile() file deleted prematurely | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-10575@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66014&edit=1
ID: 66014
Updated by: aharvey@php.net
Reported by: divinity76 at gmail dot com
Summary: tmpfile() file deleted prematurely
-Status: Assigned
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: irrelevant?Win7 x64 and Debian7
PHP Version: 5.5.5
Assigned To: aharvey
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2013-11-01 00:48:30] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=332039
Log: Note that the file returned by tmpfile() may be closed once out of scope.
Fixes doc bug #66014 (tmpfile() file deleted prematurely).
------------------------------------------------------------------------
[2013-11-01 00:07:05] aharvey@php.net
Documentation issue; I'll fix it up shortly.
------------------------------------------------------------------------
[2013-10-31 23:46:59] divinity76 at gmail dot com
Description:
------------
(according to docs) "~The file is automatically removed when closed (using fclose()), or when
the script ends."
but seems it is also automatically removed when the last reference to the resource handle is
removed/overwritten/whatever-its-called
either the implementation or the docs seems to be wrong here
Test script:
---------------
<?php
$h=tmpfile();
if($h===false){throw new Exception('tmpfile() failed!');};
//$hh=$h;
$h=stream_get_meta_data($h);//pretty sure its deleted here..
$h=$h['uri'];
var_dump(fopen($h,'r'));
Expected result:
----------------
resource(X) of type (stream)
Actual result:
--------------
Warning: fopen(/tmp/phpS6THmC): failed to open stream: No such file or directory in /in//in/IkpAW on
line 8
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66014&edit=1