Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

question

WHEN does the integer output of get_user_count() turns into an array ?

background

The function get_user_count() in ms-functions.php returns an integer (it calls get_site_option('user_count')

The function wp_version_check() in update.php stores this integer in $user_count on line 55

Directly after that on line 73 it calls this integer with $user_count['total_users']

reason for asking

On my network admin pages I get the error:

Warning: Illegal string offset 'total_users' in /opt/htdocs/html/wp-includes/update.php on line 75

So I need to understand where I need to look (probably something I did somewhere)

see also: http://wordpress.org/support/topic/illegal-string-offset-total_users?replies=14#post-2893756

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Via:

I find:

  1. Normally it would return an array from the cache
  2. Meaning the return value of get_user_count() is different than in the php doc above it
  3. But... if the cache does not contain it, it will return an integer leading (in my case) to an warning (requesting an array value from a string) BUT somehow not leading to a warning with many others (assuming they still have an array as return value, even if it does not contain a value)

I found out that when on PHP version 5.4 or later it will throw this warning. Previous versions will not throw this warning, related, see example 2 on http://php.net/manual/en/function.empty.php

It has been taken care of in 20966

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.