|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43276 mkdir with trailing slash (still) fails under safe_mode
Submitted: 2007-11-13 12:01 UTC Modified: 2007-11-15 18:58 UTC
From: ajakum at inode dot at Assigned: iliaa (profile)
Status: Closed Package: Directory function related
PHP Version: 5.2CVS-2007-11-13 (snap) OS: Debian Sarge 3.1
Private report: No CVE-ID: None
 [2007-11-13 12:01 UTC] ajakum at inode dot at
Experienced the same issue as in bug #42739 with the current CVS snapshot php5.2-200711130930 even though it's supposed to be fixed in 5.2.5 according to the changelog.
mkdir() fails under safe_mode conditions if the path ends in a slash.

Fixed temporarily by reverting revision of TSRM/tsrm_virtual_cwd.c "Consistent handling of trailing slash".

Running on a completely fresh Debian Sarge install with php5.2-200711130930 from Only change was activation of safe_mode in order to reproduce the problem.

Reproduce code:
  mkdir('myhomefolder/',0770); // does not work
  //mkdir('myhomefolder',0770); // would work

Expected result:
myhomefolder should get created (=no error)

Actual result:
Warning: mkdir(): Unable to access myhomefolder/ in /home/foo/test.php on line 2


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-14 23:38 UTC]
Ilia, you claimed to have fixed this? :)
 [2007-11-15 18:58 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Mar 31 18:03:37 2023 UTC