|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #67020 Lower severity of error when directory already exists
Submitted: 2014-04-04 13:35 UTC Modified: 2014-04-13 11:35 UTC
From: spam06 at geekhood dot net Assigned:
Status: Wont fix Package: Directory function related
PHP Version: 5.6.0alpha3 OS: *
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.
Block user comment
Status: Assign to:
Bug Type:
From: spam06 at geekhood dot net
New email:
PHP Version: OS:


 [2014-04-04 13:35 UTC] spam06 at geekhood dot net
Currently when mkdir() finds that the directory already exists it triggers E_WARNING.

IMHO this is unnecessarily high severity, as the error is generally harmless. The whole point of this function is to make the directory exist.

I suggest lowering the severity to E_NOTICE.

Test script:

Expected result:
Notice: mkdir(): File exists

Actual result:
Warning: mkdir(): File exists


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-13 11:35 UTC]
-Status: Open +Status: Wont fix
 [2014-04-13 11:35 UTC]

mkdir failing can be a serious issue when you pass a specific $mode and if the directory already exists, the mode won't be changed for that.
putting all this aside, this is how it work since the beginning, so I don't really see it worthwile to change it without any significant gain.
if you are not interested in the success of the mkdir call, or why exactly it failed, you can call it with the error supression(@) operator.
if you still think that you want to push this change, please write an rfc and start a discussion on the mailing list to gauge what others think about this idea.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 21:01:30 2024 UTC