Make WordPress Core

Ticket #17780: miqro-17780-compat.patch

File miqro-17780-compat.patch, 1.8 KB (added by miqrogroove, 11 years ago)

Compatibility for PHP < 5.4.

  • src/wp-includes/formatting.php

     
    688688                $quote_style = ENT_NOQUOTES;
    689689        }
    690690
     691        if ( ! $double_encode ) {
     692                // Guarantee every &entity; is valid, convert &garbage; into &amp;garbage;
     693                // This is required for PHP < 5.4.
     694                $string = wp_kses_normalize_entities( $string );
     695        }
     696
    691697        $string = @htmlspecialchars( $string, $quote_style, $charset, $double_encode );
    692698
    693699        // Backwards compatibility
  • tests/phpunit/tests/formatting/EscHtml.php

     
    3434
    3535        function test_ignores_existing_entities() {
    3636                $source = '&#038; &#x00A3; &#x22; &amp;';
    37                 $res = '&#038; &#x00A3; &#x22; &amp;';
     37                $res = '&#038; &#xA3; &#x22; &amp;';
    3838                $this->assertEquals( $res, esc_html($source) );
    3939        }
    4040}
  • tests/phpunit/tests/formatting/WPSpecialchars.php

     
    8585                return array(
    8686                        array(
    8787                                'This & that, this &amp; that, &#8212; &quot; &QUOT; &Uacute; &nbsp; &#34; &#034; &#0034; &#x00022; &#x22; &dollar; &times;',
    88                                 'This &amp; that, this &amp; that, &#8212; &quot; &amp;QUOT; &Uacute; &nbsp; &#34; &#034; &#0034; &#x00022; &#x22; &amp;dollar; &times;',
     88                                'This &amp; that, this &amp; that, &#8212; &quot; &amp;QUOT; &Uacute; &nbsp; &#034; &#034; &#034; &#x22; &#x22; &amp;dollar; &times;',
    8989                        ),
    9090                        array(
    9191                                '&& &&amp; &amp;&amp; &amp;;',