Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#47323 closed defect (bug) (fixed)

Upgrading from WordPress 5.1 to 5.2.1 generates a fatal error

Reported by: imath's profile imath Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.2.1 Priority: normal
Severity: blocker Version: 5.2
Component: Upgrade/Install Keywords: has-patch commit dev-reviewed
Focuses: Cc:

Description

Hi,

I'm using the WordPress Beta Tester plugin, when I upgrade from WordPress 5.1 to WordPress 5.2.1, the upgrade is interrupted by a fatal error because wp_get_update_php_annotation() is not yet available.

Attachments (1)

47323.diff (1.2 KB) - added by dd32 5 years ago.

Download all attachments as: .zip

Change History (13)

#1 @dd32
5 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 5.2.1
  • Severity changed from normal to blocker

Introduced in [45357] / #46937

upgrade-core.php runs in the context of the previous WordPress version, any function calls to almost any function added after it was introduced need to be checked via function_exists().

In addition to the mention wp_get_update_php_annotation(), wp_get_update_php_url() (WP 5.1) will also need checking.

@dd32
5 years ago

#2 @dd32
5 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

Attached patch, untested.

Needs to be tested for an upgrade from 5.1.1 and 5.0.4 to nightly after review commit to trunk.

How I personally test changes like this, prior to committing or it being in a live ZIP file that WordPress can update to:

  • checkout a copy of the version of WordPress you wish to upgrade from
  • Copy the latest trunk/master version of src/wp-admin/includes/update-core.php over the top of it, overwriting the version it came with.
  • Alter src/wp-admin/includes/class-core-upgrader.php to not overwrite the above file (For example: https://github.com/WordPress/wordpress-develop/commit/e552d2fdd26fc87f5c3d1a49c6a0ff00a0c68e0b )
  • Upgrade, through WP-CLI, wp-admin, or through a cron-task if you're testing background updates.

The result is that WordPress will attempt to upgrade using the locally modified version of update-core.php, which you can also verify by adding an extra echo or logging to the file.

This ticket was mentioned in Slack in #core by dd32. View the logs.


5 years ago

#4 @SergeyBiryukov
5 years ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#5 @desrosj
5 years ago

In my testing today, this seems to do the trick.

@SergeyBiryukov if your review returns the same results, let's get this in trunk to test updating to nightly.

#6 @earnjam
5 years ago

Patch worked for me when updating from 5.1.1 using the beta tester plugin as noted in original ticket. Thanks for the testing tip @dd32.

#7 @desrosj
5 years ago

  • Keywords commit added; needs-testing removed

#8 @SergeyBiryukov
5 years ago

Reproduced the issue using the steps from comment:2, the patch works as expected.

#9 @SergeyBiryukov
5 years ago

  • Keywords dev-reviewed added

#10 @SergeyBiryukov
5 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 45365:

Upgrade/Install: As a follow-up to [45357], when linking to Update PHP support page in error messages, check if wp_get_update_php_url() and wp_get_update_php_annotation() exist.

wp-admin/includes/update-core.php runs in the context of the previous WordPress version. Any calls to newly introduced functions there need to be checked via function_exists().

Reviewed by desrosj, earnjam, SergeyBiryukov.

Props dd32, imath.
Fixes #47323.

#11 @SergeyBiryukov
5 years ago

In 45366:

Upgrade/Install: As a follow-up to [45357], when linking to Update PHP support page in error messages, check if wp_get_update_php_url() and wp_get_update_php_annotation() exist.

wp-admin/includes/update-core.php runs in the context of the previous WordPress version. Any calls to newly introduced functions there need to be checked via function_exists().

Reviewed by desrosj, earnjam, SergeyBiryukov.

Props dd32, imath.
Merges [45365] to the 5.2 branch.
Fixes #47323.

This ticket was mentioned in Slack in #core by earnjam. View the logs.


5 years ago

Note: See TracTickets for help on using tickets.