Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#18813 closed defect (bug) (invalid)

Media Buttons missing with non english URL-s

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

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 15 years ago.
str_replace()
18813.2.patch​ (588 bytes ) - added by SergeyBiryukov 15 years ago.
sprintf() before the filter

Download all attachments as: .zip

Change History (7)

@SergeyBiryukov
15 years ago

str_replace()

@SergeyBiryukov
15 years ago

sprintf() before the filter

#1 @SergeyBiryukov
15 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​.

#2 @SergeyBiryukov
15 years ago

  • Component Editor → I18N
  • Milestone Awaiting Review → 3.4

#3 @nacin
15 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.

#4 @nacin
15 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.

#5 @SergeyBiryukov
15 years ago

  • Milestone 3.4
  • Resolution → invalid
  • Status new → closed

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

Note: See TracTickets for help on using tickets.