|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-07-22 18:38 UTC] ktierney at akamai dot com
-Status: Open
+Status: Closed
[2016-07-22 18:38 UTC] ktierney at akamai dot com
[2016-07-23 01:18 UTC] requinix@php.net
-Status: Closed
+Status: Not a bug
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 14:00:01 2025 UTC |
Description: ------------ (PHP5.5.9) In creating a directory using "mkdir('./results/16/07/22/G2/4', 0777, true), all but the last (4) subdirectory is created. The function returns true, no exception is thrown. This happens when the PHP script containing the line is run on an Apache2.4/7 web server. When the same function is run in interactive PHP, it works fine. safe_mode is off in both php.ini files. I substituted the CreateDirPath() function for it, but I get the same behavior on the server and interactively. Test script: --------------- $test['path'] = './results/16/07/22/G2/4'; mkdir($test['path'], 0777, true); -- and -- function CreateDirPath($dirpath, $rwx = 0777) { $x = preg_replace('/\.\//', '', $dirpath); $dlst = explode('/', $x); $cwd = $xdir = getcwd(); try { foreach ($dlst as $d) { $dt = trim($d); if ($dt) { $xdir = "$xdir/$dt"; if (!is_dir($xdir)) { if (!mkdir($dt, $rwx)) return false; } if (!chdir($xdir)) return false; } } return chdir($cwd); } catch(Exception $e) { return false; } } Expected result: ---------------- I expect all the directories to be created with a permission of 0777. CreateDirPath() does this interactively, but behaves the same as mkdir() when run under Apache.