php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77187 mkdir() fails to create dir after using some func-s on the parent dir
Submitted: 2018-11-22 23:37 UTC Modified: 2018-11-24 14:45 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: batonxleba at gmail dot com Assigned:
Status: Open Package: Directory function related
PHP Version: 7.2.10 OS: gentoo
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: batonxleba at gmail dot com
New email:
PHP Version: OS:

 

 [2018-11-22 23:37 UTC] batonxleba at gmail dot com
Description:
------------
mkdir () does not create a subdirectory and generates an error when I try to create it in a directory that has the same name as the file that was deleted before this but any of the is_dir / file_exists / is_writable functions were applied to it.
if i comment line 5 in example below script will work fine.

my cli php
PHP 7.2.10 (cli) (built: Nov 10 2018 11:44:18) ( ZTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.10, Copyright (c) 1999-2018, by Zend Technologies


Test script:
---------------
#!/usr/bin/php
<?php
exec('> vpupkin');

if(is_dir('vpupkin'))print 'true'."\n";

exec('rm -f vpupkin');
mkdir('vpupkin',0700);
mkdir('vpupkin/'.date("d.m.Y"),0700);

?>

Actual result:
--------------
dev ~/testftp # rm -r vpupkin; ./t.php
PHP Warning:  mkdir(): No such file or directory in /root/testftp/t.php on line 9

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-23 10:39 UTC] a at b dot c dot de
Other observations from a Win10 build consistent with the above:
1) clearstatcache() doesn't affect behaviour
2) Being Windows, using "del" instead of an "rm" port doesn't fix things.
3) a single mkdir('vpupkin/'.date("d.m.Y"), 0700, true) call fails in the same way as the two consecutive mkdirs() (vpupkin is created but can't be found to create the subdirectory within it).
4) using unlink() instead of exec('rm') does allow the subdirectory to be created.
 [2018-11-24 14:43 UTC] batonxleba at gmail dot com
unlink() solved the problem for me, thanks a lot!
 [2018-11-24 14:45 UTC] batonxleba at gmail dot com
-PHP Version: 7.2.12 +PHP Version: 7.2.10
 [2018-11-24 14:45 UTC] batonxleba at gmail dot com
UPD: Using unlink() instead of exec('rm') solved the problem for me.
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Thu Dec 13 09:01:26 2018 UTC