WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#41449 closed defect (bug) (fixed)

Calling a member function on a string object in class-wp-ajax-upgrader-skin.php

Reported by: yrpwayne Owned by: SergeyBiryukov
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.6
Component: Upgrade/Install Keywords:
Focuses: Cc:
PR Number:

Description

In the file:

wp-admin\includes\class-wp-ajax-upgrader-skin.php

on line 102: there is a call to get_error_codes() when the object is a string

public function error( $errors ) {
  if ( is_string( $errors ) ) {
    ...
    $errors_count = count( $errors->get_error_codes() );
    ...
  }
  ...

Change History (4)

#1 @yrpwayne
2 years ago

Looking at the line it should be counting the class variable $errors

Change line 102 to:

$errors_count = count( $this->errors->get_error_codes() );

#2 @SergeyBiryukov
2 years ago

  • Milestone changed from Awaiting Review to 4.9
  • Version changed from trunk to 4.6

Hi @yrpwayne, welcome to WordPress Trac!

Thanks for the report, introduced in [38199].

#3 @SergeyBiryukov
2 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 41157:

Upgrade/Install: In WP_Ajax_Upgrader_Skin, call ::get_error_codes() method on a WP_Error object $this->errors instead of a string variable $errors.

Props yrpwayne.
Fixes #41449.

#4 @obenland
2 years ago

#42430 was marked as a duplicate.

Note: See TracTickets for help on using tickets.