WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

#18813 closed defect (bug) (invalid)

Media Buttons missing with non english URL-s

Reported by: mangus Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: I18N Keywords:
Focuses: Cc:

Description

Description

In add post/page editor there are no "Upload/Insert" buttons, but there is PHP error message under other editor buttons:

Warning: printf() [function.printf]: Too few arguments in /home/idnetee/lisadomeenid/parmu.ee/ökoküla/wp-admin/includes/media.php on line 400

How to reproduce

  • Wordpress 3.2.1 (tested with Estonian version).
  • URL encoded non english site aadress (for example http://parmu.ee/%C3%B6kok%C3%BCla -- without URL encoding Wordpress can't handle it -- http://parmu.ee/ökoküla)
  • A plug-in, that uses site URL in 'media_buttons_context' (for example "1 Flash Gallery")
  • Go to add new post and there are no "Insert/Upload" buttons but an error message.

Possible solution

Not a nice solution, but it works.

Line 400 in media.php:

printf($context, $out);

Replace it:

echo str_replace(' %s', ' ' . $out, $context);

Attachments (2)

18813.patch (429 bytes) - added by SergeyBiryukov 3 years ago.
str_replace()
18813.2.patch (588 bytes) - added by SergeyBiryukov 3 years ago.
sprintf() before the filter

Download all attachments as: .zip

Change History (7)

SergeyBiryukov3 years ago

str_replace()

SergeyBiryukov3 years ago

sprintf() before the filter

comment:1 SergeyBiryukov3 years ago

  • Keywords has-patch added

To prevent non-ASCII characters in site URL being interpreted as placeholders, we can probably use sprintf() before the filter, and then filter the whole output.

"1 Flash Gallery" works fine with both of the patches, but other plugins may require an update with 18813.2.patch.

comment:2 SergeyBiryukov2 years ago

  • Component changed from Editor to I18N
  • Milestone changed from Awaiting Review to 3.4

comment:3 nacin2 years ago

I would prefer the str_replace. We were careful to maintain compatibility for this filter in #17578, and would rather not change how it works now.

comment:4 nacin2 years ago

  • Keywords has-patch removed

Actually, this is no longer an issue after #17578. While we maintained the filter over the context, but it now appears inside of <a> tags, which means that no link could be used in there anymore. A plugin like 1 Flash Gallery would need to be updated to use the media_buttons action, as they should have been previously. I think it would end up breaking for regular domains, too, for 3.3.

comment:5 SergeyBiryukov2 years ago

  • Milestone 3.4 deleted
  • Resolution set to invalid
  • Status changed from new to closed

Indeed, the plugin should have used media_buttons action for adding buttons.

Note: See TracTickets for help on using tickets.