Title: Illegal string offset &#039;total_users&#039;
Last modified: August 20, 2016

---

# Illegal string offset 'total_users'

 *  Resolved [cogmios](https://wordpress.org/support/users/cogmios/)
 * (@cogmios)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/)
 * see [http://wordpress.org/support/topic/illegal-string-offset-total-users?replies=5#post-2889483](http://wordpress.org/support/topic/illegal-string-offset-total-users?replies=5#post-2889483)
 * Direct after upgrading to 3.4 I noticed Illegal string offset ‘total_users’ in
   update.php on line 75.
 * On line 55 it requests
 * `$user_count = get_user_count( );`
 * I echo this value and it is an integer (2) so not an array
 * on line 73 however it requests
 * `$user_count['total_users'],`
 * (so an array….. ) this is where it fails on my WP multisite install.
 * So im thinking what could be wrong since my get_user_count() does not return 
   an array but just “2” (so an integer)
 * (but obviously this should be an array since it has been an array for always)

Viewing 15 replies - 1 through 15 (of 23 total)

1 [2](https://wordpress.org/support/topic/illegal-string-offset-total_users/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/illegal-string-offset-total_users/page/2/?output_format=md)

 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813063)
 * Where are you getting the error? On the list users page in the network dash or…?
 *  Thread Starter [cogmios](https://wordpress.org/support/users/cogmios/)
 * (@cogmios)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813075)
 * not on any of the normal blog admin pages but on all network admin pages.
 * I echo “$user_count” and it returns 2
 * so the only thing i can think of is that there is somewhere a (new) filter on
   site_option_user_count that changes the value from an array to an integer.
 * so… im downloading (now) the complete site and plugins to my local disk to serach
   for something that could do that
 * im not sure though
 *  Thread Starter [cogmios](https://wordpress.org/support/users/cogmios/)
 * (@cogmios)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813090)
 * However….
 * ms-functions does :
 *     ```
       $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'") );
       	update_site_option( 'user_count', $count );
       ```
   
 * and get_site_option in option.php called by get_user_count in ms-function.php
   all treat $user_count as an integer
 * So … where DOES it get converted to an array so that in update.php it can actually
   request $user_count[‘total_users’],
 * ?????
 * (for non multisite it gets to be an array in count_users in user.php)
 *  Thread Starter [cogmios](https://wordpress.org/support/users/cogmios/)
 * (@cogmios)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813138)
 * Im stuck 🙁 will sleep over it
 * see also [http://wordpress.stackexchange.com/questions/55175/when-does-output-of-get-user-count-turns-into-an-array](http://wordpress.stackexchange.com/questions/55175/when-does-output-of-get-user-count-turns-into-an-array)
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813154)
 * > I echo “$user_count” and it returns 2
 * Yeah, that’s where you’re losing me 😉
 * Where/why/how are you doing that?
 * > not on any of the normal blog admin pages but on all network admin pages.
 * Do you mean on every single network admin page, you get that error?
 *  Thread Starter [cogmios](https://wordpress.org/support/users/cogmios/)
 * (@cogmios)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813181)
 * a. yes on every single network admin page
    b. open “\wp-includes\update.php c.
   look at line 55 (3.4) it reads “$user_count = get_user_count( );” d. so… $user_count
   is an integer e.g. 2 e. now look at line 73 it reads “$user_count[‘total_users’]”
   f. how can that be? requesting an array value “total users” from an integer?
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813188)
 * I’m ignoring b through f for a reason, so bear with me. 🙂
 * The error:
 * > Warning: Illegal string offset ‘total_users’ in /opt/htdocs/html/wp-includes/
   > update.php on line 75
 * There’s no reason for you to be mucking around in core, and since WP works just
   fine, no errors, for pretty much everyone else with this, it’s something you ‘
   did’ 🙂
 * The update.php file is for “Check WordPress version against the newest version.”
   You can really totally ignore that. I know that’s what the error says, it’s not
   what it means.
 * So. Manually reinstall 3.4 before we go anywhere else.
 *  Thread Starter [cogmios](https://wordpress.org/support/users/cogmios/)
 * (@cogmios)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813331)
 * “no errors, for pretty much everyone else with this,”
 * are you sure about that?
    What happens when you turn “show errors” on with
 *     ```
       ini_set('display_errors',1);
       error_reporting(E_ALL & ~E_STRICT);
       ```
   
 * ? Do you now see it?
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813351)
 * Nope.
 * But if that was the only way you were able to produce those errors, we have a
   new track to run down.
 * What version of PHP are you using? (5.3.13 for me right now, soon to be .14)
 *  Thread Starter [cogmios](https://wordpress.org/support/users/cogmios/)
 * (@cogmios)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813357)
 * 5.4.3. … ah… you want me to upgrade to 5.4.4. ? Let me try that. Im also creating
   a second (clean) multisite on the same (Amazon Linux) server to test, takes some
   time.
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813358)
 * I don’t think that 5.4.4 eould really matter, honestly, but it very well could
   be a PHP issue.
 * Have you done a manual reinstall of WP yet?
 *  Thread Starter [cogmios](https://wordpress.org/support/users/cogmios/)
 * (@cogmios)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813359)
 * ‘Have you done a manual reinstall of WP yet? ‘
 * yep i did a svn export [http://core.svn.wordpress.org/trunk/](http://core.svn.wordpress.org/trunk/)–-
   force . in the root of the site and the first thing i see after logging in is
 * *Warning: Illegal string offset ‘total_users’ in /opt/htdocs/html/wp-includes/
   update.php on line 73* 🙂
 * hey… the file was edited its now 2 lines higher up 🙂
 * (and 5.4.4 @ ./configure –prefix=/opt/php –with-config-file-path=P/opt/php/etc–
   with-config-file-scan-dir=/opt/php/etc/php.d –enable-fpm –with-curl –with-mysql
   =mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-zlib –with-openssl–
   with-mcrypt –enable-mbstring –enable-mbregex –with-gd –with-jpeg-dir –with-png-
   dir –with-xmlrpc -disable-cgi)
 * p.s. running nginx and phpfpm also
 *  [Eric Mann](https://wordpress.org/support/users/ericmann/)
 * (@ericmann)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813361)
 * I just checked the logic, and it does look (at least from here) like you’ve found
   an issue.
 * The call to `get_user_count()` on a Multisite installation does in fact return
   an integer. The return of this function is assumed to be an array (stored in `
   $user_count`) and is referenced as such farther down in the update script.
 * A couple of us are looking in to what exactly changed and whether or not this
   is actually a bug …
 *  Thread Starter [cogmios](https://wordpress.org/support/users/cogmios/)
 * (@cogmios)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813364)
 * Thanks [http://wordpress.stackexchange.com/users/46/eamann](http://wordpress.stackexchange.com/users/46/eamann)
   🙂
 * for reference: i checked back some versions but it seems to be there for some
   time, even when it was
 * `$url = "http://api.wordpress.org/core/version-check/1.6/?version=$wp_version&
   php=$php_version&locale=$locale&mysql=$mysql_version&local_package=$local_package&
   blogs=$num_blogs&users={$user_count['total_users']}&multisite_enabled=$multisite_enabled";`
 * instead. So I would expect that WordPress.org would have noticed on the other
   end that when during a year all requests from multisite installations would be
   bad concerning user_count someone would notice….?
 * That is why i am / was doubting.
 * But if it is really a bug it is good to know that really nothing is done with
   all that data *GRIN*
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/#post-2813366)
 * [http://lists.automattic.com/pipermail/wp-hackers/2012-June/043295.html](http://lists.automattic.com/pipermail/wp-hackers/2012-June/043295.html)
 * >  When the variables are set. In multisite, we use get_user_count() (a cached
   > 
   > array), while in single site, we call count_users() (a direct count).
 * Not sure it is a bug, if that’s related.

Viewing 15 replies - 1 through 15 (of 23 total)

1 [2](https://wordpress.org/support/topic/illegal-string-offset-total_users/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/illegal-string-offset-total_users/page/2/?output_format=md)

The topic ‘Illegal string offset 'total_users'’ is closed to new replies.

 * In: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
 * 23 replies
 * 4 participants
 * Last reply from: [o6asan](https://wordpress.org/support/users/o6asan/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/page/2/#post-2813551)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
