WordPress.org

Make WordPress Core

Opened 13 months ago

Last modified 11 months ago

#20854 new defect (bug)

functions.php on line 155 ?

Reported by: leondari Owned by: Nikolaos Raftopoulos
Priority: normal Milestone: Awaiting Review
Component: Multisite Version: 3.3.2
Severity: normal Keywords: reporter-feedback
Cc:

Description

In my network dashboard I get the following error message :

Warning: number_format() expects parameter 1 to be double, string given in /home/tklighth/public_html/wp-includes/functions.php on line 155

Attachments (1)

20854.diff (753 bytes) - added by kobenland 13 months ago.
Wraps $count in absint()

Download all attachments as: .zip

Change History (5)

comment:1 scribu13 months ago

  • Keywords reporter-feedback added; needs-codex needs-testing removed

Install this in your mu-plugins folder to get more information about the error:

https://raw.github.com/gist/625769/e26b3eb9b5ccaeeda75dc266fdbd6f8e36da51f5/backtrace-errors.php

comment:3 kobenland13 months ago

I have the same warning in my 3.3.2 (and prior) install, but I can't seem to reproduce it in 3.4-RC2.

The number of users are stored in a site option, which is fed by a query returning a string:

//in wp-includes/ms-functions.php line 1980
$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 );

kobenland13 months ago

Wraps $count in absint()

comment:4 SergeyBiryukov11 months ago

I can reproduce in 3.4.1 with a custom user table which doesn't contain spam and deleted fields.
wp_update_network_counts() then fails to update user_count site meta value:

SELECT COUNT(ID) as c FROM wp_users WHERE spam = '0' AND deleted = '0'
Unknown column 'spam' in 'where clause'

user_count ends up being an empty string, which leads to the notice.

Note: See TracTickets for help on using tickets.