WordPress.org

Make WordPress Core

Ticket #27214: 27214.patch

File 27214.patch, 1.1 KB (added by SergeyBiryukov, 6 years ago)
  • src/wp-admin/includes/misc.php

     
    314314                return array();
    315315
    316316        $tokens = token_get_all( $content );
     317        $count = count( $tokens );
    317318        $functions = array();
    318319        $ignore_functions = array();
    319         for ( $t = 0, $count = count( $tokens ); $t < $count; $t++ ) {
    320                 if ( !is_array( $tokens[$t] ) ) continue;
    321                 if ( T_STRING == $tokens[$t][0] && ( '(' == $tokens[ $t + 1 ] || '(' == $tokens[ $t + 2 ] ) ) {
     320        for ( $t = 0; $t < $count - 2; $t++ ) {
     321                if ( ! is_array( $tokens[ $t ] ) ) {
     322                        continue;
     323                }
     324
     325                if ( T_STRING == $tokens[ $t ][0] && ( '(' == $tokens[ $t + 1 ] || '(' == $tokens[ $t + 2 ] ) ) {
    322326                        // If it's a function or class defined locally, there's not going to be any docs available
    323327                        if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ) ) ) || ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR == $tokens[ $t - 1 ][0] ) ) {
    324328                                $ignore_functions[] = $tokens[$t][1];