Make WordPress Core

Ticket #13202: 13202.patch

File 13202.patch, 1.6 KB (added by hakre, 15 years ago)
  • wp-includes/functions.php

     
    31583158
    31593159        // Allow plugin to filter the output error trigger
    31603160        if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
     3161
     3162                // gain info about context by looking in backtrace
     3163                $context = '';
     3164                $trace   = debug_backtrace();
     3165                if ( 1 < count( $trace ) && ( $trace = $trace[1] ) ) {
     3166                        // handle missing information on lambdas etc.
     3167                        foreach ( array('line', 'file') as $set )
     3168                                if ( !isset( $trace[$set] ) )
     3169                                        $trace[$set] = "[no $set context]";
     3170
     3171                        // remove ABSPATH from filename
     3172                        if ( '[' != $trace[$set][0] )
     3173                                $trace[$set] = substr( $trace[$set], strlen( ABSPATH ) );
     3174
     3175                        $context = sprintf(' Called in file <strong>%s</strong> on line %s.', htmlspecialchars($trace['file']), $trace['line']);
     3176                }
     3177
    31613178                if ( ! is_null($replacement) )
    3162                         trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
     3179                        trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.%4$s'), $function, $version, $replacement, $context ) );
    31633180                else
    3164                         trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
     3181                        trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.%3$s'), $function, $version, $context ) );
    31653182        }
    31663183}
    31673184