Fix #12671: Installer page doesn't check if MySQL tables were created successfully#11494
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @root@MO-LT-0519.localdomain. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
5eabf4b to
69b4220
Compare
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
631c10a to
f93008c
Compare
26d1f0e to
188c3df
Compare
…created-on-install
…created-on-install
Core Track Ticket: https://core.trac.wordpress.org/ticket/12671
Problem:
In simple terms, WordPress is saying "installation succeeded" even when it could not create the database tables it needs.
So the installer does this:
It tries to create the core tables like wp_users, wp_options, wp_posts.
MySQL rejects those CREATE TABLE queries because the DB user does not have permission.
WordPress prints a lot of database errors.
But after that, it still shows:
Success! WordPress has been installed. Thank you, and enjoy!
That leaves you with a broken install and an empty or incomplete database.
The misleading success screen is rendered in wp-admin/install.php, while the table creation happens through wp-admin/includes/upgrade.php.
Root Cause:
There are really two connected problems.
wp_install() calls make_db_current_silent() in wp-admin/includes/upgrade.php.
That helper currently just calls dbDelta() and does not check whether the table-creation queries actually worked.
dbDelta() also runs the SQL queries without stopping or returning an actual failure signal when a CREATE TABLE query fails.
So WordPress continues as if setup is still progressing, even though the database schema was never created.
After wp_install() returns, wp-admin/install.php immediately prints the success page.
It does not verify things like:
whether table creation failed
whether wp_install() returned an error
whether required tables now exist
whether later setup steps failed because the tables were missing
So the current flow is basically:
try install
show DB errors on screen
still print success message
That is why the behavior looks so wrong.
Solution:
The fix should make the installer treat failed table creation as a real installation failure.
Recommended fix
Make the install schema step detectable when it fails. In wp-admin/includes/upgrade.php, the code path used by wp_install() should capture failure from table creation instead of silently ignoring it.
Make wp_install() stop when schema creation fails. If the required tables cannot be created, wp_install() should return a WP_Error or otherwise abort before continuing with:
populate_options()
populate_roles()
user creation
default content setup
Make wp-admin/install.php check the result before showing success. If wp_install() fails, the installer should show a clear error message instead of the success screen.