Bug->Doc #66014 [Opn->Asn]: tmpfile() file deleted prematurely

From: Date: Fri, 01 Nov 2013 00:07:05 +0000
Subject: Bug->Doc #66014 [Opn->Asn]: tmpfile() file deleted prematurely
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10574@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: Open +Status: Assigned -Type: Bug +Type: Documentation Problem -Package: *General Issues +Package: Documentation problem Operating System: irrelevant?Win7 x64 and Debian7 PHP Version: 5.5.5 -Assigned To: +Assigned To: aharvey Block user comment: N Private report: N New Comment: Documentation issue; I'll fix it up shortly. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#10574) next »