WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#20443 closed defect (bug) (fixed)

Featured image cannot be set if WordPress install path contains spaces

Reported by: rosshanney Owned by: ryan
Milestone: 3.4 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch commit
Focuses: Cc:

Description

If WordPress is installed in a directory with a name that contains spaces ("/home/username/public_html/path with spaces", for example), the Featured Image meta box displays only a PHP warning, preventing a Featured Image from being set.

The warning is as follows, and seems to appear with or without WP_DEBUG enabled:

Warning: sprintf() [function.sprintf]: Too few arguments in C:\path\htdocs\path with spaces\wp-admin\includes\post.php on line 1149

I think this is caused by the extra % characters introduced after encoding the URL from get_upload_iframe_src, which confuse the subsequent sprintf calls.

As reported here on the support forums.

Attachments (1)

20443.diff (1.6 KB) - added by rosshanney 3 years ago.

Download all attachments as: .zip

Change History (4)

@rosshanney3 years ago

comment:1 @SergeyBiryukov3 years ago

  • Keywords has-patch commit added
  • Milestone changed from Awaiting Review to 3.4

comment:2 @nacin3 years ago

I am surprised this is the only thing that breaks.

comment:3 @ryan3 years ago

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

In [20594]:

Pass the upload iframe src url as an arg to sprintf to avoid treating octets as
format specifiers. Fixes setting the featured image on blogs containing spaces in the install path. Props rosshanney. fixes #20443

Note: See TracTickets for help on using tickets.