WordPress.org

Make WordPress Core

Changeset 27323


Ignore:
Timestamp:
02/27/14 23:15:29 (3 years ago)
Author:
SergeyBiryukov
Message:

Avoid an undefined index notice in wp_doc_link_parse().

props pross for initial patch.
fixes #27214.

File:
1 edited

Legend:

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

    r26995 r27323  
    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] ) ) { 
Note: See TracChangeset for help on using the changeset viewer.