Make WordPress Core

Ticket #58357: 58357.diff

File 58357.diff, 1.1 KB (added by Presskopp, 21 months ago)
  • wp-includes/formatting.php

     
    754754        // Find all elements.
    755755        $textarr = wp_html_split( $haystack );
    756756        $changed = false;
     757        $c               = count( $textarr );
    757758
    758759        // Optimize when searching for one item.
    759760        if ( 1 === count( $replace_pairs ) ) {
     
    762763                }
    763764
    764765                // Loop through delimiters (elements) only.
    765                 for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
     766                for ( $i = 1, $c; $i < $c; $i += 2 ) {
    766767                        if ( false !== strpos( $textarr[ $i ], $needle ) ) {
    767768                                $textarr[ $i ] = str_replace( $needle, $replace, $textarr[ $i ] );
    768769                                $changed       = true;
     
    773774                $needles = array_keys( $replace_pairs );
    774775
    775776                // Loop through delimiters (elements) only.
    776                 for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
     777                for ( $i = 1, $c; $i < $c; $i += 2 ) {
    777778                        foreach ( $needles as $needle ) {
    778779                                if ( false !== strpos( $textarr[ $i ], $needle ) ) {
    779780                                        $textarr[ $i ] = strtr( $textarr[ $i ], $replace_pairs );