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
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: 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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 14:01:31 2024 UTC