Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#34619 closed defect (bug) (fixed)

Avoid using HTML tags in translation strings (wp-admin/includes/upgrade.php)

Reported by: ramiy's profile ramiy Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch commit
Focuses: Cc:

Description

Found a wrong use of str_replace() in translations strings. We should use sprintf() instead.

See the attached patch fixing this issue.

Attachments (3)

34619.patch (1.1 KB) - added by ramiy 10 years ago.
34619.2.patch (1.1 KB) - added by ramiy 10 years ago.
34619.3.patch (2.2 KB) - added by SergeyBiryukov 10 years ago.

Download all attachments as: .zip

Change History (12)

@ramiy
10 years ago

@ramiy
10 years ago

#1 @ramiy
10 years ago

The second patch better - this way we avoid using HTML tags in the translation strings.

#2 @ramiy
10 years ago

  • Summary changed from Use sprintf() instead of str_replace() in translations strings to Avoid using HTML tags in translation strings (wp-admin/includes/upgrade.php)

#3 @ramiy
10 years ago

  • Keywords has-patch added

#4 follow-up: @SergeyBiryukov
10 years ago

The same string is also used in tags/4.3.1/src/wp-admin/includes/schema.php#L977.

It's a site option used for newly created sites in Multisite. We can't remove str_replace() here, it would still be needed for back-compat with the stored text.

#5 in reply to: ↑ 4 ; follow-ups: @ramiy
10 years ago

Can we use sprintf() strings in both places?

#6 in reply to: ↑ 5 @SergeyBiryukov
10 years ago

Replying to ramiy:

Can we use sprintf() strings in both places?

Haven't tested yet, but I think it was done this way because network_home_url() or get_current_site() is not available yet when populate_network() run for the first time.

#7 @ramiy
10 years ago

OK, I didn't know that. I guess you can close this ticket.

#8 in reply to: ↑ 5 @SergeyBiryukov
10 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 4.4

Replying to ramiy:

Can we use sprintf() strings in both places?

On second thought, I think 34619.3.patch might work.

We still need str_replace() for back-compat, but at least the string would now be correct.

#9 @SergeyBiryukov
10 years ago

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

In 35614:

Remove non-translatable HTML code from the first post content in populate_network() and wp_install_defaults().

Add translator comment.

Props ramiy.
Fixes #34619.

Note: See TracTickets for help on using tickets.