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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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 19 07:01:27 2024 UTC