WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#19644 closed defect (bug) (fixed)

Unwanted backslash in output

Reported by: donpaolo Owned by: ryan
Milestone: 3.3.1 Priority: normal
Severity: minor Version: 3.3
Component: UI Keywords: has-patch commit
Focuses: Cc:

Description

After upgrading to 3.3 I got the windows notificating me the new features.

the "Media uploader updated" notification says in italian translation:

Ora l\'icona unificata "media" lancia un uploader per tutti i tipi di file, e la nuova interfaccia "drag and drop" rende il caricamento un gioco da ragazzi.

You see there is a backslash which shouldn't be there. I think it's not a translation error, but a bug in the treating of those strings.

Attachments (1)

19644.patch (2.5 KB) - added by ocean90 2 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 ocean902 years ago

The translation is:

Ora l'icona unificata \"media\" lancia un uploader per tutti i tipi di file, e la nuova interfaccia \"drag and drop\" rende il caricamento un gioco da ragazzi.

comment:2 ocean902 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 3.3.1

The problem is in json_encode( esc_js( ) ):

$string = "Foo'bar \"Hello\"";
var_dump( ( esc_js( $string ) ); // string(26) "Foo\'bar "Hello""
var_dump( json_encode( esc_js( $string ) ) ); // string(29) ""Foo\\'bar "Hello"""
var_dump( json_encode( $string ); // string(19) ""Foo'bar \"Hello\"""
var_dump( esc_js( json_encode( $string ) ) ); // string(38) ""Foo\'bar "Hello"""

ocean902 years ago

comment:3 ocean902 years ago

  • Keywords has-patch dev-feedback added; needs-patch removed

19644.patch does remove the esc_js calls.

comment:4 nacin2 years ago

  • Keywords commit added; dev-feedback removed

Works for me, I think esc_js() was there from before we started to take the arguments and pass them to json_encode().

comment:5 nacin2 years ago

In [19655]:

Remove esc_js() as this content now gets json encoded rather than a straight echo. props ocean90. see #19644, for trunk.

comment:6 ryan2 years ago

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

In [19659]:

Remove esc_js() as this content now gets json encoded rather than a straight echo. props ocean90. fixes #19644, for 3.3

Note: See TracTickets for help on using tickets.