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 8 replies - 16 through 23 (of 23 total)

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

 *  [Eric Mann](https://wordpress.org/support/users/ericmann/)
 * (@ericmann)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/page/2/#post-2813368)
 * OK, I’ve dug into things a bit and I think this both is and is not a bug.
 * Yes, the code looks strange. If we’re on multisite, `$user_count` is set to an
   integer. In a standalone installation, it’s set to an array.
 * The `$query` variable is then constructed from a set of variables, one being `
   $user_count['total_users']`. Logically, this should fail for Multisite, and that’s
   exactly what you’re seeing.
 * _However,_ and this is a big however, I can’t reproduce the warning you’re seeing.
   Even setting WP_DEBUG and forcing E_ALL for error reporting, `$user_count['total_users']`
   returns the integer value and _not_ a warning or error.
 * I’ve tried this on two different Apache systems and an Nginx system. I can’t 
   get that error back out of the system, though I can see exactly where it would
   come up. I’ll post a ticket on Trac anyway, but I’m not seeing this as a wide-
   reaching issue (See [#20966](https://core.trac.wordpress.org/ticket/20966)).
 * A short-term fix for you would be to turn off or lower your PHP warning settings.
 *  Thread Starter [cogmios](https://wordpress.org/support/users/cogmios/)
 * (@cogmios)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/page/2/#post-2813435)
 * I found out… that if I run in a PHP version < 5.4
 *     ```
       $expected_array_got_string = 'somestring';
       echo $expected_array_got_string['some_key'];
       ```
   
 * that it returns “s”
 * However starting from PHP version 5.4. it will throw: Warning: Illegal string
   offset ‘some_key’
 * 🙂
 * I think that’s the reason for the low amount of users seeing it…
 * (see also example 2 here: [http://php.net/manual/en/function.empty.php](http://php.net/manual/en/function.empty.php))
 * SO… to see the warning… simply install PHP version 5.4 or later 🙂
 *  [o6asan](https://wordpress.org/support/users/o6asan/)
 * (@o6asan)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/page/2/#post-2813488)
 * Thanks for your infomation, cogmios.
 * I know this topic is resolved. But I have the same PHP warning, so, I want to
   say “Thank you!”. I also want to add the next information.
 * You wrote:
 * > However starting from PHP version 5.4. it will throw: Warning: Illegal string
   > offset ‘some_key’
 * However, PHP version 5.4 also returns “s” by my test.
 * When I test the next script, a PHP version < 5.4 returns “0”, but PHP version
   5.4 returns “1”.
 *     ```
       $expected_array_got_string = 'somestring';
       echo empty($expected_array_got_string['some_key']);
       ```
   
 *  Thread Starter [cogmios](https://wordpress.org/support/users/cogmios/)
 * (@cogmios)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/page/2/#post-2813520)
 * Yeah… it seems we are part of the 0.2% grin
 *  [Eric Mann](https://wordpress.org/support/users/ericmann/)
 * (@ericmann)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/page/2/#post-2813529)
 * In case you haven’t been following along, this has been fixed in Core, so it 
   shouldn’t be a problem with the next version:
 * [https://core.trac.wordpress.org/changeset/21105](https://core.trac.wordpress.org/changeset/21105)
 *  [Eric Mann](https://wordpress.org/support/users/ericmann/)
 * (@ericmann)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/page/2/#post-2813534)
 * The patch was included in 3.4.1. After you upgrade, let me know for sure that
   it resolved the issue. But you should be golden 🙂
 *  Thread Starter [cogmios](https://wordpress.org/support/users/cogmios/)
 * (@cogmios)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/page/2/#post-2813535)
 * 18:31 : illegal offset
    18:31 : You can update to WordPress 3.4.1 automatically
   or download the package and install it manually: click 18:32 : message gone
 *  [o6asan](https://wordpress.org/support/users/o6asan/)
 * (@o6asan)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/illegal-string-offset-total_users/page/2/#post-2813551)
 * Today, I updated my site. The message has gone, too.
 * Thanks.

Viewing 8 replies - 16 through 23 (of 23 total)

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

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
