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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
19 - 15 = ?
Subscribe to this entry?

 
 [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 Mar 28 18:01:29 2024 UTC