#8830 closed defect (bug) (fixed)
wp_mkdir_p doesn't work with safe mode enabled
Reported by: | remi | Owned by: | |
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | 2.7 |
Component: | Filesystem API | Keywords: | needs-patch bug-hunt |
Focuses: | Cc: |
Description
The wp_mkdir_p
function (which is used by many WP features like media uploading) doesn't work when PHP's safe-mode is enabled because it allows trailing slashes at the end of the directories it tries to create.
Adding this code at the beginning of the function solves the problem:
if (substr($target, -1) == "/") { $target = substr($target, 0, -1); }
Attachments (1)
Change History (16)
#7
@
15 years ago
- Keywords needs-patch added; has-patch needs-review removed
- Milestone changed from 2.9 to Future Release
- Type changed from defect (bug) to enhancement
$target = / is problematic.
#10
follow-up:
↓ 12
@
14 years ago
perhaps this should be added instead:
$target = untrailingslashit($target); if ( empty($target) ) $target = '/';
#11
@
14 years ago
- Type changed from enhancement to defect (bug)
also, this is a defect, It doesnt operate correctly under safe mode.
#12
in reply to:
↑ 10
@
14 years ago
Replying to dd32:
perhaps this should be added instead:
$target = untrailingslashit($target); if ( empty($target) ) $target = '/';
Sounds good.
Note: See
TracTickets for help on using
tickets.
I'm not 100% this won't have side effects