[wp-trac] [WordPress Trac] #21663: Use PDO or mysqli for MySQL queries when available

WordPress Trac noreply at wordpress.org
Mon Feb 3 00:45:45 UTC 2014


#21663: Use PDO or mysqli for MySQL queries when available
------------------------------+------------------
 Reporter:  scottconnerly     |       Owner:
     Type:  task (blessed)    |      Status:  new
 Priority:  normal            |   Milestone:  3.9
Component:  Database          |     Version:  3.5
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |     Focuses:
------------------------------+------------------
Changes (by nacin):

 * keywords:  dev-feedback has-patch needs-testing => has-patch commit


Comment:

 This ticket was opened to use a non-deprecated API when available. I'm
 going to modify that a bit, but the general goal is the same. Here are the
 goals for 3.9:

  * Use mysqli when PHP 5.5+, assuming it is available.
  * Offer the ability to not use ext/mysql even when PHP 5.4 or below, but
 this will not be the default.

 pento is right: We should move away from ext/mysql as soon as possible. I
 will say I don't think it's simply because PHP has decided it's now
 deprecated. Honestly, this matters fairly little. Rather, eventually we're
 going to need mysqli to be our default, and in order to get there in a
 sane fashion, we need to get this in core at the PHP 5.5+ level first.

 Why? (And why 5.5?) Well, one, WordPress already works pretty well under
 ext/mysql, and we've gotten used to its quirks, and I wouldn't want to
 suddenly break a site that's been working fine under PHP 5.2-5.4. Two, the
 bigger issue is that a lot of plugins are going to be affected, and that's
 what's probably gonna break a site. Easing this in (5.5 only) is the only
 way to do this without causing a complete disaster.

 A driver is out of scope for this ticket. The only goal of this ticket is
 to get our foot in the door and to signal to plugin developers they need
 to stop using direct mysql_* functions. (We can email the author of every
 plugin that uses mysql_* functions, FWIW, and we will do so.)

 So, again, the plan for 3.9:

  * Use mysqli when PHP 5.5+, assuming it is available.
  * [attachment:21663.10.diff] is ready for commit.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/21663#comment:173>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list