ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: shaitan on February 03, 2017, 04:36:52 pm

Title: Always same error in logs
Post by: shaitan on February 03, 2017, 04:36:52 pm
Hello,

I see always those error in logs:

(https://static.forum.mpdb.tv/uploadimages/images/1486157226-erreur.png)

Code: [Select]
==>520:		return number_format($number, (float) $number === $number ? ($override_decimal_count === false ? $decimal_count : $override_decimal_count) : 0, $decimal_separator, $thousands_separator);



Title: Re: Always same error in logs
Post by: emanuele on February 04, 2017, 02:42:34 am
That is a terribly weird one.
Does it happen only with that specific URL (https://forum.mpdb.tv/index.php?https://forum.mpdb.tv/) or with other URLs as well?
Title: Re: Always same error in logs
Post by: shaitan on February 04, 2017, 03:15:35 am
Sometimes it happens at this address:    

https://forum.mpdb.tv/index.php?
Code: [Select]
Fichier: /home/shaitan/www/forum/sources/Subs.php
Ligne: 520

But most of the time it's the other address

If your need Admin access, files access, no problem.

 

Title: Re: Always same error in logs
Post by: emanuele on February 04, 2017, 08:45:22 am
AHA!
Little nasty bug! :P
And anyway it's a SimplePortal bug, so...
/me blames @Spuds  O:-)

Simple fix is to change in sources/subs/PortalBlocks.subs.php:
Code: [Select]
		$totals += array(
'average_members' => comma_format(round($averages['registers'] / $total_days_up, 2)),
'average_posts' => comma_format(round($averages['posts'] / $total_days_up, 2)),
'average_topics' => comma_format(round($averages['topics'] / $total_days_up, 2)),
'average_online' => comma_format(round($averages['most_on'] / $total_days_up, 2)),
);
to:
Code: [Select]
		$totals += array(
'average_members' => round($averages['registers'] / $total_days_up, 2),
'average_posts' => round($averages['posts'] / $total_days_up, 2),
'average_topics' => round($averages['topics'] / $total_days_up, 2),
'average_online' => round($averages['most_on'] / $total_days_up, 2),
);

Mostly unrelated: @Spuds do you think it would be hard to add the whole stack trace of functions (the function/class names should be mostly enough) to the error log?
The current one was designed to work with the monolithic structure of SMF with no more than two to five nested function calls, and I feel that the more we add functions, the more difficult is to track down where the actual problem is. :-\
Title: Re: Always same error in logs
Post by: Spuds on February 04, 2017, 09:04:00 am
Why is comma_format causing a problem?

No idea what would be involved in adding additional trace info to the error.log.  Makes sense to add it, just not sure what is needed!
Title: Re: Always same error in logs
Post by: emanuele on February 04, 2017, 09:05:36 am
Because it's applied twice: there and few lines below when the numbers are echo'ed.
Title: Re: Always same error in logs
Post by: Spuds on February 04, 2017, 09:14:37 am
Ah ha ... I think comma_format should be smart enough to handle my sloppy coding !
Title: Re: Always same error in logs
Post by: shaitan on February 04, 2017, 09:40:10 am
Beautiful, threre are no more errors in my logs !

Many thanks !




 
Title: Re: Always same error in logs
Post by: emanuele on February 04, 2017, 12:33:09 pm
You know how strict is php when it comes to accepting data types! LOL