Make WordPress Core


Ignore:
Timestamp:
02/27/2018 02:30:46 AM (7 years ago)
Author:
SergeyBiryukov
Message:

General: Introduce WP_Error::has_errors() method and use it where appropriate.

Props robdxw, DrewAPicture, SergeyBiryukov.
Fixes #42742.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-ajax-upgrader-skin.php

    r42343 r42761  
    6262
    6363        foreach ( $this->errors->get_error_codes() as $error_code ) {
    64             if ( $this->errors->get_error_data( $error_code ) && is_string( $this->errors->get_error_data( $error_code ) ) ) {
    65                 $messages[] = $this->errors->get_error_message( $error_code ) . ' ' . esc_html( strip_tags( $this->errors->get_error_data( $error_code ) ) );
     64            $error_data = $this->errors->get_error_data( $error_code );
     65
     66            if ( $error_data && is_string( $error_data ) ) {
     67                $messages[] = $this->errors->get_error_message( $error_code ) . ' ' . esc_html( strip_tags( $error_data ) );
    6668            } else {
    6769                $messages[] = $this->errors->get_error_message( $error_code );
Note: See TracChangeset for help on using the changeset viewer.