Make WordPress Core


Ignore:
Timestamp:
03/08/2018 05:07:04 PM (9 years ago)
Author:
SergeyBiryukov
Message:

General: In wp_debug_backtrace_summary(), normalize paths before replacement for better cross–platform compatibility.

Props Rarst.
Fixes #43501.

File:
1 edited

Legend:

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

    r42787 r42800  
    53675367 * @see https://core.trac.wordpress.org/ticket/19589
    53685368 *
     5369 * @staticvar array $truncate_paths Array of paths to truncate.
     5370 *
    53695371 * @param string $ignore_class Optional. A class to ignore all function calls within - useful
    53705372 *                             when you want to just give info about the callee. Default null.
     
    53775379 */
    53785380function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) {
     5381        static $truncate_paths;
     5382
    53795383        if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) ) {
    53805384                $trace = debug_backtrace( false );
     
    53865390        $check_class = ! is_null( $ignore_class );
    53875391        $skip_frames++; // skip this function
     5392
     5393        if ( ! isset( $truncate_paths ) ) {
     5394                $truncate_paths = array(
     5395                        wp_normalize_path( WP_CONTENT_DIR ),
     5396                        wp_normalize_path( ABSPATH )
     5397                );
     5398        }
    53885399
    53895400        foreach ( $trace as $call ) {
     
    54005411                                $caller[] = "{$call['function']}('{$call['args'][0]}')";
    54015412                        } elseif ( in_array( $call['function'], array( 'include', 'include_once', 'require', 'require_once' ) ) ) {
    5402                                 $caller[] = $call['function'] . "('" . str_replace( array( WP_CONTENT_DIR, ABSPATH ), '', $call['args'][0] ) . "')";
     5413                                $caller[] = $call['function'] . "('" . str_replace( $truncate_paths, '', wp_normalize_path( $call['args'][0] ) ) . "')";
    54035414                        } else {
    54045415                                $caller[] = $call['function'];
Note: See TracChangeset for help on using the changeset viewer.