php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72818 PHP warning: ZipArchive::close(): Renaming temporary file failed: No such file
Submitted: 2016-08-12 03:02 UTC Modified: 2021-02-12 16:14 UTC
Votes:23
Avg. Score:4.1 ± 1.2
Reproduced:17 of 19 (89.5%)
Same Version:2 (11.8%)
Same OS:5 (29.4%)
From: starrychloe at oliveyou dot net Assigned: cmb (profile)
Status: Not a bug Package: Zip Related
PHP Version: 5.6.24 OS: Cygwin
Private report: No CVE-ID: None
 [2016-08-12 03:02 UTC] starrychloe at oliveyou dot net
Description:
------------
Cannot create a zip file. 

PHP warning:  ZipArchive::close(): Renaming temporary file failed: No such file or directory

No search results.

https://duckduckgo.com/?q=PHP+warning%3A+ZipArchive%3A%3Aclose()%3A+%22Renaming+temporary+file+failed%3A+No+such+file+or+directory%22&ia=web

http://stackoverflow.com/questions/38886193/php-ziparchiveclose-renaming-temporary-file-failed-no-such-file-or-direct

Cygwin 2.5.2
Windows 8.1.
PHP 5.6.24 (cli) (built: Jul 22 2016 03:53:28)


Test script:
---------------
Psy Shell v0.7.2 (PHP 5.6.24 — cli) by Justin Hileman
>>> $zip = new ZipArchive()
=> ZipArchive {#185
     +"status": 0,
     +"statusSys": 0,
     +"numFiles": 0,
     +"filename": "",
     +"comment": "",
   }
>>> $zip->open('/tmp/tmp.zip', ZipArchive::CREATE)
=> true
>>> $zip->addFile('/tmp/tmp.txt')
=> true
>>> $zip->close()
PHP warning:  ZipArchive::close(): Renaming temporary file failed: No such file or directory on line 1
>>>

The /tmp/tmp.txt file exists.

Expected result:
----------------
I expect it to create the zip file without warning.

Actual result:
--------------
PHP warning:  ZipArchive::close(): Renaming temporary file failed: No such file or directory on line 1


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-12 11:52 UTC] cmb@php.net
-Operating System: Windows 8.1 +Operating System: Cygwin
 [2016-08-12 11:52 UTC] cmb@php.net
Works as expected on native Windows 10; most likely a Cygwin issue.
 [2016-12-28 11:48 UTC] pharscape at gmail dot com
On Windows 10 I found that if you add a delay between the addFile() and close() this <random> error disappears.
 [2018-02-15 07:41 UTC] small75 at list dot ru
Hi!
Same problem on
Windows 10 Pro 1709
XAMPP for Windows
PHP Version 5.6.31
Apache/2.4.26 (Win32) OpenSSL/1.0.2l PHP/5.6.31 

PHP Warning:  ZipArchive::close(): Renaming temporary file failed: No such file or directory in
 [2021-02-12 16:14 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2021-02-12 16:14 UTC] cmb@php.net
I just checked, and this error message relates to ZIP_ER_RENAME,
so this would be an upstream issue.  Consider to report that as
issue there[1].

[1] <https://github.com/nih-at/libzip/issues>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 06:01:29 2024 UTC