Make WordPress Core


Ignore:
Timestamp:
06/18/2015 09:59:10 PM (10 years ago)
Author:
wonderboymusic
Message:

Since PHP 5.2.3, the htmlspecialchars() function has an optional $double_encode parameter, which we can now use. This will save us a few expensive kses/html decoding calls.

Adds unit tests.

Props miqrogroove.
Fixes #17780.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/formatting/JSEscape.php

    r25002 r32850  
    2424
    2525    function test_js_escape_amp() {
    26         $out = esc_js('foo & bar &baz; '');
    27         $this->assertEquals("foo & bar &baz; '", $out);
     26        $out = esc_js('foo & bar &baz;  ');
     27        $this->assertEquals("foo & bar &baz;  ", $out);
    2828    }
    2929
    3030    function test_js_escape_quote_entity() {
    3131        $out = esc_js('foo ' bar ' baz &');
    32         $this->assertEquals("foo \\' bar \\' baz &", $out);
     32        $this->assertEquals("foo \\' bar \\' baz &", $out);
    3333    }
    3434
Note: See TracChangeset for help on using the changeset viewer.