php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #73997 rename() won't overwrite existing directory
Submitted: 2017-01-25 16:55 UTC Modified: 2017-04-05 19:02 UTC
From: tim dot aagaard at gmail dot com Assigned: peehaa (profile)
Status: Closed Package: Filesystem function related
PHP Version: Irrelevant OS: NA
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 !
Your email address:
MUST BE VALID
Solve the problem:
15 + 18 = ?
Subscribe to this entry?

 
 [2017-01-25 16:55 UTC] tim dot aagaard at gmail dot com
Description:
------------
"rename — Renames a file or directory"

"Attempts to rename oldname to newname, moving it between directories if necessary. If newname exists, it will be overwritten."

Rename will not overwrite a directory that already exists.

Test script:
---------------
mkdir('a/', 0777);
mkdir('b/', 0777);
rename('a/', 'b/');

Actual result:
--------------
Warning: rename(a/,b/): File exists

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-25 16:57 UTC] tim dot aagaard at gmail dot com
This behavior should be noted somewhere in the documentation
 [2017-01-25 22:41 UTC] cmb@php.net
-Summary: Incorrect documentation +Summary: rename() won't overwrite existing directory -Package: Documentation problem +Package: Filesystem function related
 [2017-04-05 19:02 UTC] peehaa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: peehaa
 [2017-04-05 19:02 UTC] peehaa@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 12:01:27 2024 UTC