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

WordPress Trac noreply at wordpress.org
Tue Feb 25 16:24:14 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:
------------------------------+------------------

Comment (by Denis-de-Bernardy):

 Replying to [comment:198 aaroncampbell]:
 > Sorry, I missed this with my last comment.  The problem has been mostly
 in unit testing.  If you define something like `USE_EXT_MYSQL` to make a
 unit test to see that it works, you can't then change it during the
 testing so that another unit test can test the other option.  If filters
 can't be run at the point where the DB is loaded though, we don't have a
 lot of options.

 For unit testing purposes, couldn't we simply add a filter that we
 explicitly document as e.g. "internal, for unit testing purposes only —
 this hook cannot be used by plugins, because these are not loaded at this
 stage".

 Alternatively, and perhaps more ideally, we could tweak the load procedure
 so to ensure that `add_filter()` exists when wp-config.php is loaded. It's
 a matter of including a couple of files in `wp-load.php`, and changing the
 calls to `require_once` (instead of `require`) in `wp-settings.php`. That
 would ensure backwards compatibility with plugins that mindlessly include
 `wp-config.php`, and forward compatibility of the needed filter.

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


More information about the wp-trac mailing list