WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#36615 closed defect (bug) (fixed)

Avoid PHP notices when trying to update translations which are already up to date

Reported by: ocean90 Owned by: ocean90
Milestone: 4.6 Priority: normal
Severity: normal Version:
Component: Upgrade/Install Keywords: needs-patch
Focuses: Cc:

Description

This is bit of a race condition:

  • Make sure that you have outdated translations and auto-updates for translations are working.
  • Go to wp-admin/update-core.php.
  • Now do something else.
  • In the meantime WP has updated the translations in the background.
  • Click the Update Translations button.

Expected: No PHP notices
Actual: PHP notices:

NOTICE: wp-admin/includes/class-wp-upgrader.php:2204 - Trying to get property of non-object
Language_Pack_Upgrader->bulk_upgrade, Language_Pack_Upgrader_Skin->before, Language_Pack_Upgrader->get_name_for_update
NOTICE: wp-admin/includes/class-wp-upgrader-skins.php:811 - Trying to get property of non-object
Language_Pack_Upgrader->bulk_upgrade, Language_Pack_Upgrader_Skin->before

Attachments (1)

36615.png (36.3 KB) - added by ocean90 4 years ago.

Download all attachments as: .zip

Change History (3)

@ocean90
4 years ago

#1 @Presskopp
4 years ago

Possible coincidence!?

wp-admin/includes/class-wp-upgrader.php
Line 1980:

$this->strings['up_to_date'] = __( 'The translation is up to date.' ); // We need to silently skip this case

#2 @ocean90
4 years ago

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

In 37635:

Upgrader: Don't use Language_Pack_Upgrader_Skin::before() and Language_Pack_Upgrader_Skin::after() when translations are up to date.

Avoids a PHP notice since Language_Pack_Upgrader_Skin::before() tries to access a non-existent update.
Also, change the up_to_date string to use the plural form because translations are only updated in bulk mode.

Fixes #36615.

Note: See TracTickets for help on using tickets.