[wp-trac] [WordPress Trac] #19644: Unwanted backslash in output

WordPress Trac wp-trac at lists.automattic.com
Thu Dec 22 16:36:07 UTC 2011


#19644: Unwanted backslash in output
--------------------------+--------------------
 Reporter:  donpaolo      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.3.1
Component:  UI            |     Version:  3.3
 Severity:  minor         |  Resolution:
 Keywords:  needs-patch   |
--------------------------+--------------------
Changes (by ocean90):

 * keywords:   => needs-patch
 * milestone:  Awaiting Review => 3.3.1


Comment:

 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"""
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19644#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list