Make WordPress Core


Ignore:
Timestamp:
12/21/2015 02:45:43 AM (9 years ago)
Author:
pento
Message:

Texturize: Transform & into & in tag attributes.

[35709] was overly broad, and stopped transforming & characters within tag attributes. So that sites aren't generating invalid HTML, we need to restore this functionality, while continuing to not transform & within blocked tags.

Merge of [36036] to the 4.4 branch.

Fixes #35008.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.4/tests/phpunit/tests/formatting/WPTexturize.php

    r35709 r36037  
    1111
    1212    function test_disable() {
    13         $this->assertEquals('<pre>---</pre>', wptexturize('<pre>---</pre>'));
    14         $this->assertEquals('<pre><code></code>--</pre>', wptexturize('<pre><code></code>--</pre>'));
    15 
    16         $this->assertEquals( '<code>---</code>',     wptexturize( '<code>---</code>'     ) );
    17         $this->assertEquals( '<kbd>---</kbd>',       wptexturize( '<kbd>---</kbd>'       ) );
    18         $this->assertEquals( '<style>---</style>',   wptexturize( '<style>---</style>'   ) );
    19         $this->assertEquals( '<script>---</script>', wptexturize( '<script>---</script>' ) );
    20         $this->assertEquals( '<tt>---</tt>',         wptexturize( '<tt>---</tt>'         ) );
     13        $this->assertEquals('<pre>---&</pre>', wptexturize('<pre>---&</pre>'));
     14        $this->assertEquals('<pre><code></code>--&</pre>', wptexturize('<pre><code></code>--&</pre>'));
     15
     16        $this->assertEquals( '<code>---&</code>',     wptexturize( '<code>---&</code>'     ) );
     17        $this->assertEquals( '<kbd>---&</kbd>',       wptexturize( '<kbd>---&</kbd>'       ) );
     18        $this->assertEquals( '<style>---&</style>',   wptexturize( '<style>---&</style>'   ) );
     19        $this->assertEquals( '<script>---&</script>', wptexturize( '<script>---&</script>' ) );
     20        $this->assertEquals( '<tt>---&</tt>',         wptexturize( '<tt>---&</tt>'         ) );
    2121
    2222        $this->assertEquals('<code>href="baba"</code> &#8220;baba&#8221;', wptexturize('<code>href="baba"</code> "baba"'));
     
    12691269            array(
    12701270                '[ photos by <a href="http://example.com/?a[]=1&a[]=2"> this guy & that guy </a> ]',
    1271                 '[ photos by <a href="http://example.com/?a[]=1&a[]=2"> this guy &#038; that guy </a> ]',
     1271                '[ photos by <a href="http://example.com/?a[]=1&#038;a[]=2"> this guy &#038; that guy </a> ]',
    12721272            ),
    12731273            array(
    12741274                '[photos by <a href="http://example.com/?a[]=1&a[]=2"> this guy & that guy </a>]',
    1275                 '[photos by <a href="http://example.com/?a[]=1&a[]=2"> this guy &#038; that guy </a>]',
     1275                '[photos by <a href="http://example.com/?a[]=1&#038;a[]=2"> this guy &#038; that guy </a>]',
     1276            ),
     1277            array(
     1278                '& <script>&&</script>',
     1279                '&#038; <script>&&</script>'
    12761280            ),
    12771281            array(
Note: See TracChangeset for help on using the changeset viewer.