WordPress.org

Make WordPress Core

Ticket #35864: 35864.0.diff

File 35864.0.diff, 1.3 KB (added by westonruter, 5 years ago)
  • src/wp-includes/formatting.php

    diff --git src/wp-includes/formatting.php src/wp-includes/formatting.php
    index 89ecbbe..01b6405 100644
    function wptexturize_primes( $haystack, $needle, $prime, $open_quote, $close_quo 
    374374 */
    375375function _wptexturize_pushpop_element( $text, &$stack, $disabled_elements ) {
    376376        // Is it an opening tag or closing tag?
    377         if ( '/' !== $text[1] ) {
     377        if ( isset( $text[1] ) && '/' !== $text[1] ) {
    378378                $opening_tag = true;
    379379                $name_offset = 1;
    380380        } elseif ( 0 == count( $stack ) ) {
  • tests/phpunit/tests/formatting/WPTexturize.php

    diff --git tests/phpunit/tests/formatting/WPTexturize.php tests/phpunit/tests/formatting/WPTexturize.php
    index 4d7caf3..afd323e 100644
    String with a number followed by a single quote !q1!Expendables 3!q1! vestibulum 
    20732073                return $this->assertLessThan( 200, $result );
    20742074        }
    20752075
     2076        /**
     2077         * Ensure that a trailing less-than symbol doesn't cause a PHP warning.
     2078         *
     2079         * @ticket 35864
     2080         */
     2081        function test_trailing_less_than() {
     2082                $this->assertEquals( 'F&#8211;oo<', wptexturize( 'F--oo<', true ) );
     2083        }
     2084
    20762085        function data_whole_posts() {
    20772086                require_once( DIR_TESTDATA . '/formatting/whole-posts.php' );
    20782087                return data_whole_posts();