WordPress.org

Make WordPress Core

Ticket #23062: 23062.diff

File 23062.diff, 4.1 KB (added by nacin, 5 years ago)
  • wp-includes/functions.php

     
    28212821        // Allow plugin to filter the output error trigger
    28222822        if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
    28232823                if ( ! is_null($replacement) )
    2824                         trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
     2824                        trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ), _wp_debug_error_type() );
    28252825                else
    2826                         trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
     2826                        trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ), _wp_debug_error_type() );
    28272827        }
    28282828}
    28292829
     
    28612861        if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
    28622862                $message = empty( $message ) ? '' : ' ' . $message;
    28632863                if ( ! is_null( $replacement ) )
    2864                         trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
     2864                        trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message, _wp_debug_error_type() );
    28652865                else
    2866                         trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
     2866                        trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message, _wp_debug_error_type() );
    28672867        }
    28682868}
    28692869/**
     
    29052905        // Allow plugin to filter the output error trigger
    29062906        if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
    29072907                if ( ! is_null( $message ) )
    2908                         trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
     2908                        trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ), _wp_debug_error_type() );
    29092909                else
    2910                         trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
     2910                        trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ), _wp_debug_error_type() );
    29112911        }
    29122912}
    29132913
     
    29412941        if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) {
    29422942                $version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version );
    29432943                $message .= ' ' . __( 'Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.' );
    2944                 trigger_error( sprintf( __( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s' ), $function, $message, $version ) );
     2944                trigger_error( sprintf( __( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s' ), $function, $message, $version ), _wp_debug_error_type() );
    29452945        }
    29462946}
    29472947
    29482948/**
     2949 * Returns the error type that should be used for deprecated and wrong behavior.
     2950 *
     2951 * Normally, E_USER_NOTICE is issued. E_USER_WARNING is issued for development builds (up to RC1).
     2952 *
     2953 * @subpackage Debug
     2954 * @since 3.6.0
     2955 * @access private
     2956 */
     2957function _wp_debug_error_type() {
     2958        static $error_type = null;
     2959        if ( isset( $error_type ) )
     2960                return $error_type;
     2961
     2962        include ABSPATH . WPINC . '/version.php';
     2963        $error_type = E_USER_NOTICE;
     2964        if ( strpos( $wp_version, '-' ) && ( strpos( $wp_version, '-alpha' ) || strpos( $wp_version, '-beta' ) || strpos( $wp_version, '-RC1' ) ) )
     2965                $error_type = E_USER_WARNING;
     2966        return $error_type;
     2967}
     2968
     2969/**
    29492970 * Is the server running earlier than 1.5.0 version of lighttpd?
    29502971 *
    29512972 * @since 2.5.0