Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#42812 closed enhancement (fixed)

Use MySQLi when available by default

Reported by: dd32's profile dd32 Owned by: dd32's profile dd32
Milestone: 4.9.2 Priority: normal
Severity: normal Version:
Component: Database Keywords: has-patch commit fixed-major
Focuses: Cc:

Description

4 years ago when we added MySQLi support to WordPress #21663 we gated MySQLi support on the PHP version, PHP 5.5+ (or if they're running a development version)

MySQLi has been extremely stable over the last 4 years, and I think it's time we open it up to more users.
For users on PHP 5.2~5.4 switching to MySQLi doesn't provide any benefits, but it does allow WordPress to consider using more of the MySQLi features (for example, #42352) as more sites change over in the future.

The attached patch enables MySQLi by default.
Setting to Future pending agreement.

Attachments (1)

42812.diff (1.7 KB) - added by dd32 7 years ago.

Download all attachments as: .zip

Change History (9)

@dd32
7 years ago

#1 @pento
7 years ago

  • Keywords commit added; 2nd-opinion removed
  • Milestone changed from Future Release to 4.9.2

Let's do it. We can roll this out in a 4.9.x release.

#2 @dd32
7 years ago

I'm hesitant to want to roll it out in a point release, purely for fear of breakage.

That being said, I can't imagine anything would really break, as we include a fallback of MySQLi -> MySQL in the event of a connection failure.. so.. lets go for it?

#3 @pento
7 years ago

Doing enhancements in point releases is going to take a bit of getting used to. Best way is to dive right in!

#4 @dd32
7 years ago

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

In 42388:

WPDB: Always use mysqli when available.

This change makes WordPress use mysqli on PHP <5.5 when available, instead of only in PHP 5.5+ and development installs.

WPDB includes a fallback to mysql in the event that the database connection fails with mysqli so incompatibilities should be few and far between.

Fixes #42812 for trunk.

#5 @dd32
7 years ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

#6 @SergeyBiryukov
7 years ago

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

In 42455:

WPDB: Always use mysqli when available.

This change makes WordPress use mysqli on PHP <5.5 when available, instead of only in PHP 5.5+ and development installs.

WPDB includes a fallback to mysql in the event that the database connection fails with mysqli so incompatibilities should be few and far between.

Props dd32.
Merges [42388] to the 4.9 branch.
Fixes #42812.

#7 @rhirschfeld
7 years ago

It was perhaps a mistake to roll this out in a point release because:

  • Those using mysql on sites where both mysql and mysqli are available experienced breakage (I can't imagine I'm the only one).
  • It's not clear to the naive user that the breakage can be corrected by defining WP_USE_EXT_MYSQL as true (or even what caused the breakage), and until it is corrected database corruption can ensue.
  • Users have no opportunity to make a backup before an automatic update.

#8 @maizey
7 years ago

I just spent the last 4 hours trying to figure out what caused many of my websites to break and fixing it. Many plugins rely on the open MySQL-Connection and cannot detect that suddenly that was switched to MySQLi. I also used the open MySQL-Connection for many things.

Thanks to @rhirschfeld who probably saved me another 4 hours with the hint on defining WP_USE_EXT_MYSQL.

(Yes i created an account for this. This issue is big.)

Note: See TracTickets for help on using tickets.