[wp-trac] [WordPress Trac] #40873: Fatal Error from class-wp-ajax-upgrader-skin.php file

WordPress Trac noreply at wordpress.org
Fri May 26 20:32:05 UTC 2017


#40873: Fatal Error from class-wp-ajax-upgrader-skin.php file
---------------------------+-----------------------------
 Reporter:  bappi.d.great  |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  General        |    Version:
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 In the file /wp-admin/includes/class-wp-ajax-upgrader-skin.php line no 86:

 {{{
 public function error( $errors ) {
                 if ( is_string( $errors ) ) {
                         $string = $errors;
                         if ( ! empty( $this->upgrader->strings[ $string ]
 ) ) {
                                 $string = $this->upgrader->strings[
 $string ];
                         }

                         if ( false !== strpos( $string, '%' ) ) {
                                 $args = func_get_args();
                                 $args = array_splice( $args, 1 );
                                 if ( ! empty( $args ) ) {
                                         $string = vsprintf( $string, $args
 );
                                 }
                         }

                         // Count existing errors to generate an unique
 error code.
                         $errors_count = count( $errors->get_error_codes()
 );
                         $this->errors->add( 'unknown_upgrade_error_' .
 $errors_count + 1 , $string );
                 } elseif ( is_wp_error( $errors ) ) {
                         foreach ( $errors->get_error_codes() as
 $error_code ) {
                                 $this->errors->add( $error_code,
 $errors->get_error_message( $error_code ), $errors->get_error_data(
 $error_code ) );
                         }
                 }

                 $args = func_get_args();
                 call_user_func_array( array( $this, 'parent::error' ),
 $args );
         }
 }}}

 Here the line {{{ $errors_count = count( $errors->get_error_codes() ); }}}
 will run if it passes {{{ if ( is_string( $errors ) ) }}} condition. But
 if {{{ $errors }}} is string, then how can it be treated as object in {{{
 $errors->get_error_codes() }}} ? Should not it be {{{
 $this->errors->get_error_codes() }}} ?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40873>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list