WordPress.org

Make WordPress Core

Opened 6 months ago

Last modified 5 months ago

#40873 new defect (bug)

Fatal Error from class-wp-ajax-upgrader-skin.php file

Reported by: bappi.d.great Owned by:
Milestone: Awaiting Review Priority: normal
Severity: critical Version:
Component: Upgrade/Install Keywords: has-patch
Focuses: Cc:

Description

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() ?

Attachments (1)

class-wp-ajax-upgrader-skin.diff (603 bytes) - added by bappi.d.great 6 months ago.
class-wp-ajax-upgrader-skin.diff patch file

Download all attachments as: .zip

Change History (5)

@bappi.d.great
6 months ago

class-wp-ajax-upgrader-skin.diff patch file

#1 @bappi.d.great
6 months ago

I have attached a patch.

#2 @bappi.d.great
6 months ago

  • Keywords has-patch added

#3 @bappi.d.great
6 months ago

  • Component changed from General to Upgrade/Install

#4 @bappi.d.great
5 months ago

  • Severity changed from normal to critical
Note: See TracTickets for help on using tickets.