News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SMF 2.0 Gold A non well formed numeric value encountered

Started by bud01100, July 05, 2011, 02:37:54 AM

Previous topic - Next topic

bud01100

Every user, including Guest are generating the following error:

A non well formed numeric value encounteredFile: /home/xxx/public_html/Sources/Subs.php Line: 742
It seems to be comming from the /index.php
91045729b7425fde09f76b5fd92320a4
Type of error: General


This is the code its choking on:
   // Format the string with our friend, number_format.
return number_format($number, is_float($number) ? ($override_decimal_count === false ? $decimal_count : $override_decimal_count) : 0, $decimal_separator, $thousands_separator);
}


Installed Mods:

1. nCode Image Resizer 1.3.1
2. Tabbed smileys 0.3.6 
3. SMF Arcade 2.5 RC1
4. Aeva Media 1.4w 
5. Stop Forum Spam 1.0

Themes being used are Helios smf 2.0 and smf Core.

Errors occur in either theme



Any Ideas?

Thanks




Kermit

My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

bud01100


Kermit

As i see it's something with Default number format ,i would suggest you to change it

AdminCP -> Features and Options -> Default number format
My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

bud01100

Quote from: Duncan85 on July 07, 2011, 04:03:07 AM
As i see it's something with Default number format ,i would suggest you to change it

AdminCP -> Features and Options -> Default number format
I've tried all the different formats, and still get the error.

I'm wondering if there is a way to print out what's being fed into that function to cause the error.


MrPhil

It would appear to me that $number is not a proper numeric value, but has some non-number junk mixed in.  Temporarily add:
// Format the string with our friend, number_format.
        echo "<p>raw number: $number</p>\n";
return number_format($number, is_float($number) ? ($override_decimal_count === false ? $decimal_count : $override_decimal_count) : 0, $decimal_separator, $thousands_separator);
}

to see if you get any strange numbers being fed to the number_format function by comma_format(). You may have to look in the page source (View > Page source) to see the debug message. Once you've confirmed that a bad $number is involved, you have to see where it comes from by adding such debug at every point that comma_format() is called. Follow the trail to see who is giving a bad number.

bud01100

#6
Quote from: MrPhil on July 07, 2011, 01:37:47 PM
It would appear to me that $number is not a proper numeric value, but has some non-number junk mixed in.  Temporarily add:
// Format the string with our friend, number_format.
        echo "<p>raw number: $number</p>\n";
return number_format($number, is_float($number) ? ($override_decimal_count === false ? $decimal_count : $override_decimal_count) : 0, $decimal_separator, $thousands_separator);
}




to see if you get any strange numbers being fed to the number_format function by comma_format(). You may have to look in the page source (View > Page source) to see the debug message. Once you've confirmed that a bad $number is involved, you have to see where it comes from by adding such debug at every point that comma_format() is called. Follow the trail to see who is giving a bad number.


Found it. Well... The first time everything looked fine, no strange chars, etc, but then I changed your code to
echo "<p>raw number: *$number*</p>\n";


And found the Most users online ever had a trailing space. Went to the DB and fixed that.

Thank you for all your help!!


MrPhil

Great! Now to find out why "Most users online" picked up a trailing space...

bud01100

Quote from: MrPhil on July 07, 2011, 04:27:44 PM
Great! Now to find out why "Most users online" picked up a trailing space...
From our conversion to 2.0, it didnt carry over the old stats.

Human error :(

Advertisement: