WordPress.org

Make WordPress Core

Opened 7 weeks ago

Closed 4 weeks ago

#47958 closed defect (bug) (fixed)

Incorrect test result for permission check of uploads directory if it doesn't exist yet

Reported by: ocean90 Owned by: ocean90
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.2
Component: Site Health Keywords: has-patch commit
Focuses: Cc:
PR Number:

Description (last modified by ocean90)

wp_get_upload_dir() returns the theoretical path of the uploads directory. When there was no upload yet the test returns an incorrect result (not writeable) because the directory doesn't exist.

Switching to wp_upload_dir(), which creates the directory on the fly, ensures a proper test result.

Attachments (1)

47958.diff (587 bytes) - added by ocean90 7 weeks ago.

Download all attachments as: .zip

Change History (5)

@ocean90
7 weeks ago

#1 @afragen
7 weeks ago

This looks like an easy win.

#2 @Clorith
4 weeks ago

  • Keywords commit added

#3 @ocean90
4 weeks ago

  • Description modified (diff)

#4 @ocean90
4 weeks ago

  • Owner set to ocean90
  • Resolution set to fixed
  • Status changed from new to closed

In 46228:

Site Health: Replace wp_get_upload_dir() with wp_upload_dir().

wp_get_upload_dir() returns the theoretical path of the uploads directory. When there was no upload yet the test returns an incorrect result (not writeable) because the directory doesn't exist. Switching to wp_upload_dir(), which creates the directory on the fly, ensures a proper test result.

Fixes #47958.

Note: See TracTickets for help on using tickets.