php.net |  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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: spam06 at geekhood dot net
New email:
PHP Version: OS:

 

 [2014-04-04 13:35 UTC] spam06 at geekhood dot net
Description:
------------
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:
---------------
<?php
mkdir("test");
mkdir("test");



Expected result:
----------------
Notice: mkdir(): File exists

Actual result:
--------------
Warning: mkdir(): File exists

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-13 11:35 UTC] tyrael@php.net
-Status: Open +Status: Wont fix
 [2014-04-13 11:35 UTC] tyrael@php.net
hi,

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-2019 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 10:01:22 2019 UTC