Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#51676 closed defect (bug) (fixed)

Installer doesn't start on fresh installation [ver. 5.5.2]

Reported by: garubi's profile garubi Owned by: whyisjake's profile whyisjake
Milestone: 5.5.3 Priority: high
Severity: critical Version: 5.5.2
Component: Upgrade/Install Keywords: has-patch dev-reviewed commit
Focuses: Cc:

Description

doing a fresh installation of WordPress ver 5.5.2
the classic "installer wizard" doesn't start and WP show the following message

One or more database tables are unavailable. The database may need to be repaired.

Being the first step of a fresh install obviously the DB has nothing to do with the problem, since at this step WP doesn't know anything about the DB.

Server info:

PHP Version 7.4.7
mysql  Ver 14.14 Distrib 5.7.32, for Linux (x86_64) using  EditLine wrapper
nginx version: nginx/1.15.8

the server hosts many other WP sites, but this is the first fresh installation of the new 5.5.2, so it's probably related to some regression introduced with the new release

Attachments (5)

51676.patch (455 bytes) - added by mukesh27 4 years ago.
Patch that fixed the issue
51676.diff (512 bytes) - added by xknown 4 years ago.
51676.2.diff (524 bytes) - added by xknown 4 years ago.
51676.3.diff (544 bytes) - added by xknown 4 years ago.
51676.4.diff (544 bytes) - added by xknown 4 years ago.

Download all attachments as: .zip

Change History (29)

#1 @garubi
4 years ago

Googling for the same problem, it looks like the problem is in

 wp-includes/functions.php at line 1756


As I found on this support forum post(https://wordpress.org/support/topic/wordpress-installer-error/#post-13600170), this code checks if the tables in db already exist, and for some reason on some environments get a false positive:

<?php
    $described_table = $wpdb->get_results( "DESCRIBE $table;" );
    if ( is_array( $described_table ) && count( $described_table ) === 0 ) {
        continue;
    }

if you replace that with:

<?php
if ( ! $wpdb->get_results( "DESCRIBE $table;" ) ) {
    continue;
}

the installer works just fine.

#2 @mukesh27
4 years ago

  • Component changed from General to Upgrade/Install
  • Keywords needs-patch added

Hi there!

Yes. I'm facing same issue for fresh installation of WordPress 5.5.2

@mukesh27
4 years ago

Patch that fixed the issue

#3 @mukesh27
4 years ago

  • Keywords has-patch added; needs-patch removed

#4 @garubi
4 years ago

Hi,
I confirm that the patch fixes the issue on our servers

Last edited 4 years ago by garubi (previous) (diff)

#5 @garubi
4 years ago

  • Version set to 5.5.2

#6 @garubi
4 years ago

#51673 was marked as a duplicate.

#7 @desrosj
4 years ago

  • Milestone changed from Awaiting Review to 5.5.3
  • Priority changed from normal to high

Thank you for the report, @garubi!

Since this was a security fix, simply reverting the code as in 51676.patch is not an option. The team is investigating and will update when there are findings!

This ticket was mentioned in Slack in #forums by clorith. View the logs.


4 years ago

@xknown
4 years ago

@xknown
4 years ago

#9 @xknown
4 years ago

In attachment:51676.2.diff, is_blog_installed doesn't longer return errors if we don't have a valid database connection.

#10 @johnbillion
4 years ago

FYI I am seeing this error locally, here's the value of those variables:

  • $described_table is null
  • $wpdb->errors is null
  • $wpdb->ready is boolean false
  • $table is string users, which is the first table returned by $wpdb->tables()

PHP 7.3
MySQL MariaDB 10.4

Last edited 4 years ago by johnbillion (previous) (diff)

#11 follow-up: @metalandcoffee
4 years ago

I tested the 52676.diff. I’ve tested it with fresh installs of 5.5.2, 5.4.3, 5.3.5, 5.2.8 and 5.1.7. All were successful.

I did not need to test 5.0.11 and 4.9.16 again because they were not broken. I have not tested the earlier installs yet. Please let me know if you’d like me to continue to go back to 3.7.

PHP version 4.0
MariaDB Version: 10.3.25

Version 1, edited 4 years ago by metalandcoffee (previous) (next) (diff)

#12 follow-up: @davidbaumwald
4 years ago

Discussed with @johnbillion and the latest patch would probably benefit from some extra parentheses.

@xknown
4 years ago

#13 in reply to: ↑ 12 @xknown
4 years ago

Replying to davidbaumwald:

Discussed with @johnbillion and the latest patch would probably benefit from some extra parentheses.

Thanks, I updated the patch in attachment:51676.3.diff.

#14 in reply to: ↑ 11 @xknown
4 years ago

Replying to metalandcoffee:

I tested the 52676.diff. I’ve tested it with fresh installs of 5.5.2, 5.4.3, 5.3.5, 5.2.8 and 5.1.7. All were successful.

I did not need to test 5.0.11 and 4.9.16 again because they were not broken. I have not tested the earlier installs yet. Please let me know if you’d like me to continue to go back to 3.7.

PHP version 4.0
MariaDB Version: 10.3.25

Can you please continue testing the patch with older releases too? I am also doing the same, having some more eyes/tests on this patch is better.

#15 @mukesh27
4 years ago

51676.3.diff patch working fine for me in fresh installation.

PHP version: 7.3.9
MariaDB: 10.4.6

Can we change condition like below

if (
	( ! $described_table && empty( $wpdb->last_error ) ) ||
	( is_array( $described_table ) && 0 === count( $described_table ) )
) {

@xknown
4 years ago

#16 @metalandcoffee
4 years ago

Just confirmed that the 4.8.15, 4.7.19 and 4.6.20 installs did not need to be tested against this patch because they did not appear as broken for me.

PHP version 7.4
MariaDB Version: 10.3.25

#17 @whyisjake
4 years ago

  • Keywords dev-reviewed commit added
  • Owner set to whyisjake
  • Status changed from new to accepted

#18 @metalandcoffee
4 years ago

Just a heads up from testing older WP versions...

I’m running into the following fatal error when I do fresh installs (via zip file download directly from the https://wordpress.org/download/releases/) for 4.0.32, 4.1.32, 4.2.29, 4.3.54, and 4.4.24.

Fatal error: Call to undefined function wp_installing() in .../wp-includes/update.php on line 640

PHP version: 5.6
MariaDB Version: 10.3.25

#19 @whyisjake
4 years ago

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

In 49452:

Upgrade/Install: During the install process, add additional checking for exising tables.

If reinstalling WordPress, there is a condition where tables would exist in the database. Ensures that when that is the case, the install process can carry along without issue.

Fixes #51676.

Props xknown, garubi, mukesh27, desrosj, johnbillion, metalandcoffee, davidbaumwald, whyisjake.

#20 @whyisjake
4 years ago

In 49453:

Upgrade/Install: During the install process, add additional checking for exising tables.

This commit brings the changes in [49452] to the 5.5 branch.

If reinstalling WordPress, there is a condition where tables would exist in the database. Ensures that when that is the case, the install process can carry along without issue.

Fixes #51676.

Props xknown, garubi, mukesh27, desrosj, johnbillion, metalandcoffee, davidbaumwald, whyisjake.

#21 @whyisjake
4 years ago

In 49454:

Upgrade/Install: During the install process, add additional checking for exising tables.

This commit brings the changes in [49452] to the 5.4 branch.

If reinstalling WordPress, there is a condition where tables would exist in the database. Ensures that when that is the case, the install process can carry along without issue.

Fixes #51676.

Props xknown, garubi, mukesh27, desrosj, johnbillion, metalandcoffee, davidbaumwald, whyisjake.

#22 @whyisjake
4 years ago

In 49455:

Upgrade/Install: During the install process, add additional checking for exising tables.

This commit brings the changes in [49452] to the 5.3 branch.

If reinstalling WordPress, there is a condition where tables would exist in the database. Ensures that$

Fixes #51676.

Props xknown, garubi, mukesh27, desrosj, johnbillion, metalandcoffee, davidbaumwald, whyisjake.

#23 @whyisjake
4 years ago

In 49456:

Upgrade/Install: During the install process, add additional checking for exising tables.

This commit brings the changes in [49452] to the 5.2 branch.

If reinstalling WordPress, there is a condition where tables would exist in the database. Ensures that$

Fixes #51676.

Props xknown, garubi, mukesh27, desrosj, johnbillion, metalandcoffee, davidbaumwald, whyisjake.

#24 @whyisjake
4 years ago

In 49457:

Upgrade/Install: During the install process, add additional checking for exising tables.

This commit brings the changes in [49452] to the 5.1 branch.

If reinstalling WordPress, there is a condition where tables would exist in the database. Ensures that$

Fixes #51676.

Props xknown, garubi, mukesh27, desrosj, johnbillion, metalandcoffee, davidbaumwald, whyisjake.

Note: See TracTickets for help on using tickets.