WordPress.org

Make WordPress Core

#21511 closed defect (bug) (fixed)

Fatal error when upgrading from older versions

Reported by: SergeyBiryukov Owned by: nacin
Milestone: 3.4.2 Priority: normal
Severity: normal Version: 3.3
Component: Upgrade/Install Keywords: has-patch
Focuses: Cc:

Description

Background: #18467

  1. If you try to upgrade from older versions (before self_admin_url() or esc_url() were introduced), you'll get a fatal error due to undefined functions, even if the upgrade itself was successful.

Upgrading from 2.9:

Fatal error: Call to undefined function self_admin_url() in wp-admin/includes/update-core.php on line 698

Upgrading from 2.7:

Fatal error: Call to undefined function esc_url() in wp-admin/includes/update-core.php on line 698
  1. The second placeholder in line 383 doesn't contain a position specifier:
    http://core.trac.wordpress.org/browser/tags/3.4.1/wp-admin/update-core.php#L382

This results in a wrong URL:

http://releases.wordpress/2.7/wp-admin/3.4.1

Which should be instead:

http://releases.wordpress/2.7/wp-admin/about.php?updated

Attachments (2)

21511.patch (2.7 KB) - added by SergeyBiryukov 21 months ago.
21511.2.patch (2.8 KB) - added by SergeyBiryukov 21 months ago.

Download all attachments as: .zip

Change History (10)

SergeyBiryukov21 months ago

comment:1 SergeyBiryukov21 months ago

A relative URL (in 21511.patch) seems to work fine in my testing.

comment:2 nacin21 months ago

We should clarify these restrictions with code comments.

This isn't a unique problem — admin-footer.php, for example, has a function_exists() call before calling get_site_option().

comment:3 SergeyBiryukov21 months ago

21511.2.patch is an attempt at the comment (similar to the one in admin-footer.php).

SergeyBiryukov21 months ago

comment:4 nacin20 months ago

As explained in IRC, the code in wp-admin/update-core.php only runs if the current version of WordPress is >= 3.4. Otherwise, the code in admin/includes/update-core.php is run. So we only need to fix this in one place.

Will fix the strings in a separate commit.

comment:5 nacin20 months ago

In [21702]:

Don't call self_admin_url() or esc_url() when declaring that WordPress updated successfully, as they may not exist in the current (just updated) version.

props SergeyBiryukov.
see #21511.
for trunk.

comment:6 nacin20 months ago

In [21703]:

Fix placeholders in 'Welcome to WordPress' successful update messages. props SergeyBiryukov. see #21511.

comment:7 nacin20 months ago

In [21704]:

Don't call self_admin_url() or esc_url() when declaring that WordPress updated successfully, as they may not exist in the current (just updated) version.

props SergeyBiryukov.
see #21511.
for the 3.4 branch.

comment:8 nacin20 months ago

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

In [21706]:

Fix a placeholder in a string without breaking said string in a branch. fixes #21511.

Note: See TracTickets for help on using tickets.