Make WordPress Core

Changeset 36578


Ignore:
Timestamp:
02/18/2016 08:30:54 PM (9 years ago)
Author:
ocean90
Message:

Formatting: Avoid a PHP warning when wptexturize() is called with a trailing less-than symbol.

Props westonruter.
Fixes #35864.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r36488 r36578  
    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;
  • trunk/tests/phpunit/tests/formatting/WPTexturize.php

    r36036 r36578  
    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' );
Note: See TracChangeset for help on using the changeset viewer.