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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tim dot aagaard at gmail dot com
New email:
PHP Version: OS:

 

 [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 26 09:01:29 2024 UTC