MyBB Community Forums

Full Version: [F] stats.php PHP error [C-StefanT]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
On my localhost 1.4.8 installation I get this:

Warning [2] number_format() expects parameter 1 to be double, string given - Line: 3666 - File: C:\wamp\www\mybb\mybb14x_public_mysql\inc\functions.php PHP 5.3.0 (WINNT)
File Line Function
[PHP] errorHandler->error
C:\wamp\www\mybb\mybb14x_public_mysql\inc\functions.php 3666 number_format
C:\wamp\www\mybb\mybb14x_public_mysql\stats.php 177 my_number_format

And, this is in the stats: Today's top poster: Nobody ( posts)

There's no number. It appears to be a PHP 5.3.0 error, doesn't happen in 5.2.9-2, and I can't reproduce on the SVN; whether that's because it's been fixed there, or I just haven't got the same conditions to reproduce on the SVN, I'm not entirely sure.

Feel free to mark as bogus if it has indeed already been fixed.
OK, this does indeed happen on the SVN so it looks like a 5.3.0 fix that's been missed. It happens when there's no posts within the last 24 hours, instead of saying Nobody (0 posts) it says Nobody ( posts), as well as the above error.
Does this work? In inc/functions.php find:

return number_format($number, $decimals, $mybb->settings['decpoint'], $mybb->settings['thousandssep']);

replace with

return number_format((double)$number, $decimals, $mybb->settings['decpoint'], $mybb->settings['thousandssep']);
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group
Yep, that does the trick Smile