[wp-trac] [WordPress Trac] #20966: Inconsistent Variable Usage
WordPress Trac
wp-trac at lists.automattic.com
Fri Jun 15 03:44:39 UTC 2012
#20966: Inconsistent Variable Usage
-----------------------------+------------------------------------
Reporter: ericmann | Owner: ericmann
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Upgrade/Install | Version: 3.4
Severity: minor | Keywords: has-patch dev-feedback
-----------------------------+------------------------------------
Someone in the forums alerted me to a potential issue with the code in
`wp_version_check()`. It seems we're using two different functions to get
a user count depending on whether we're in Multisite or a standalone
installation.
The Multisite function (`get_user_count()`) returns a number. The
standalone function (`count_users()`) returns an array. We then assume
the array when we use the variable later to build the version check query.
In some situations, this can result in an "illegal string offset" error.
In other situations, it will generate inaccurate data. Assume the
following situation:
- `get_user_count()` returns "100" because there are 100 users.
- `$user_count['total_users']` will return "1"
When you reference a string as an array with an offset that doesn't exist,
it only returns the first digit. So our count, in this case, is only
accurate for Multisite installations with 1-9 users.
Not a huge end-user issue ... but confusing for WP.org stats in the long
run if it remains unpatched.
I have worked out a patch that will fix the stat reporting issue for us
and silence any "illegal string offset" issues other developers might be
experiencing.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20966>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list