[wp-trac] [WordPress Trac] #40779: function_exists() audit in wp-db.php

WordPress Trac noreply at wordpress.org
Tue May 16 14:52:52 UTC 2017


#40779: function_exists() audit in wp-db.php
---------------------------------------+------------------------------
 Reporter:  johnjamesjacoby            |       Owner:
     Type:  defect (bug)               |      Status:  new
 Priority:  low                        |   Milestone:  Awaiting Review
Component:  Database                   |     Version:
 Severity:  minor                      |  Resolution:
 Keywords:  needs-testing 2nd-opinion  |     Focuses:
---------------------------------------+------------------------------
Description changed by johnjamesjacoby:

Old description:

> A few `function_exists()` checks can be removed from `wp-db.php`, thanks
> to recent load order changes, probably nobody having looked in a while,
> and generally being afraid to break DB drop-ins:
>
> All of these are ahead of `require_wp_db()`:
>
> * `function_exists('is_multisite')` (load.php)
> * `function_exists('_deprecated_function')` (functions.php)
> * `function_exists( 'mb_strlen' )` (compat.php)
> * `mb_check_encoding()` could *maybe* be a new function in compat.php
> (it's used 3 times)
>
> ----
>
> The only caveats are 10+ year-old HyperDB versions that do the old-school
> deep-integration thing, of directly including files – they'll need extra
> scrutiny.

New description:

 A few `function_exists()` checks can be removed from `wp-db.php`, thanks
 to recent load order changes, probably nobody having looked in a while,
 and generally being afraid to break DB drop-ins:

 All of these functions are in files now loaded ahead of `require_wp_db()`:

 * `is_multisite` (load.php)
 * `_deprecated_function` (functions.php)
 * `mb_strlen` (compat.php)

 Bonus:

 * `mb_check_encoding()` could *maybe* be a new function in compat.php
 (it's used 3 times in core, using `@` or `function_exists`)

 ----

 The only caveats are the installation process, and 10+ year-old HyperDB
 versions that do the old-school deep-integration thing, of directly
 including files – they'll need extra scrutiny.

--

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


More information about the wp-trac mailing list