[wp-trac] [WordPress Trac] #23196: mkdir not recursive (in wp-includes/functions.php)
WordPress Trac
noreply at wordpress.org
Mon Jan 14 08:35:52 UTC 2013
#23196: mkdir not recursive (in wp-includes/functions.php)
-----------------------------+--------------------------
Reporter: uuf6429 | Type: defect (bug)
Status: new | Priority: normal
Milestone: Awaiting Review | Component: General
Version: | Severity: normal
Keywords: has-patch |
-----------------------------+--------------------------
This January, Wordpress tried to create a directory and a subdirectory in
"uploads": "2013" and inside it "01".
`mkdir($target)` was used to create these two directories, but since the
$recursive option (3rd argument) was not set, this operation failed.
I have just checked this path and it does exist, hence I suspect this
procedure is being done somewhere else (and succeeding).
Still, this is a problem since:
1. It is showing up in our error logging system.
2. It is very easy to fix.
3. It potentially fixes more problems than it seems.
The solution is to change this line:
1306: if ( @mkdir( $target ) ) {
To the following:
1306: if ( @mkdir( $target, 0777, true ) ) {
On a sidenote, PHP's default directory creation mode is 0777 (so the above
code is best for compatibility), but as you may know, it is not good in
terms of security, so you may want to look for a more secure fix (eg,
lowering the mode if it doesn't cause problems).
--
Ticket URL: <http://core.trac.wordpress.org/ticket/23196>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list