-
-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rounding causes errors with variable substitution #4548
Comments
Change the command from $allindex = ($elements - 1) * $p;
$intvalindex = floor($allindex);
$floatval = $allindex - $intvalindex; |
CMDPHP PHP ERROR Backtrace and other errors
I committed the update. |
Not fixed. 09.02.2022 11:49:29 - CMDPHP PHP ERROR Backtrace: (/data_templates.php[44]:form_save(), /data_templates.php[253]:push_out_data_source(), /lib/template.php[221]:update_data_source_title_cache_from_template(), /lib/variables.php[37]:update_data_source_title_cache(), /lib/variables.php[99]:get_data_source_title(), /lib/functions.php[2449]:expand_title(), /lib/variables.php[234]:substitute_host_data(), /lib/variables.php[313]:get_uptime(), /lib/functions.php[5181]:get_daysfromtime(), /lib/functions.php[5203]:CactiErrorHandler())09.02.2022 11:49:29 - ERROR PHP DEPRECATED: Implicit conversion from float 59626.9 to int loses precision in file: /var/www/html/lib/functions.php on line: 5203 |
What's on line 5203 in your version? |
5203 - $time %= $mod;
|
In my version of lib/functions.php |
Though the line numbers are not adding up, trying to get this resolved.
I did another update following your back-trace and not the line numbers since they don't even match on the 1.2.x branch. |
Nope. I changed this to $time = floor($mod); |
Well, that's one, but I also looked at the backtrace and what is happening is that the hosts sysUptimeInstance was being divided by 100, which is proper, and that converted the "time" value that was sent to the next function was a float, which having a modulus on a float could also throw the loss of precision error. So, I converted it to an integer (I think). You need to make the next update and see if the backtraces go away. |
I may have to add use |
Let's not mess with tickets. I'm only caring about 1.2.x in this ticket. |
Right now, I'm not even working on 1.3 tickets. @netniV and I have to get it back into shape after the 1.2.20 release. |
I'm sorry. |
Good to hear. I'll look at your issue on Import as well. |
08.02.2022 10:21:09 - CMDPHP PHP ERROR Backtrace: (/graph_realtime.php[218]:rrdtool_function_graph(), /lib/rrd.php[1949]:rrd_substitute_host_query_data(), /lib/rrd.php[2515]:substitute_host_data(), /lib/variables.php[313]:get_uptime(), /lib/functions.php[5181]:get_daysfromtime(), /lib/functions.php[5203]:CactiErrorHandler())
08.02.2022 10:21:09 - ERROR PHP DEPRECATED: Implicit conversion from float 2741440.6 to int loses precision in file: /var/www/html/lib/functions.php on line: 5203
08.02.2022 10:21:09 - CMDPHP PHP ERROR Backtrace: (/graph_realtime.php[218]:rrdtool_function_graph(), /lib/rrd.php[1583]:rrd_substitute_host_query_data(), /lib/rrd.php[2515]:substitute_host_data(), /lib/variables.php[313]:get_uptime(), /lib/functions.php[5181]:get_daysfromtime(), /lib/functions.php[5203]:CactiErrorHandler())
08.02.2022 10:21:09 - ERROR PHP DEPRECATED: Implicit conversion from float 2741440.6 to int loses precision in file: /var/www/html/lib/functions.php on line: 5203
08.02.2022 10:21:09 - CMDPHP PHP ERROR Backtrace: (/graph_realtime.php[218]:rrdtool_function_graph(), /lib/rrd.php[1583]:rrd_substitute_host_query_data(), /lib/rrd.php[2515]:substitute_host_data(), /lib/variables.php[313]:get_uptime(), /lib/functions.php[5181]:get_daysfromtime(), /lib/functions.php[5203]:CactiErrorHandler())
08.02.2022 10:21:09 - ERROR PHP DEPRECATED: Implicit conversion from float 2741440.6 to int loses precision in file: /var/www/html/lib/functions.php on line: 5203
08.02.2022 10:21:09 - CMDPHP PHP ERROR Backtrace: (/graph_realtime.php[218]:rrdtool_function_graph(), /lib/rrd.php[1583]:rrd_substitute_host_query_data(), /lib/rrd.php[2515]:substitute_host_data(), /lib/variables.php[313]:get_uptime(), /lib/functions.php[5181]:get_daysfromtime(), /lib/functions.php[5203]:CactiErrorHandler())
08.02.2022 10:21:09 - ERROR PHP DEPRECATED: Implicit conversion from float 2741440.6 to int loses precision in file: /var/www/html/lib/functions.php on line: 5203
08.02.2022 10:21:09 - CMDPHP PHP ERROR Backtrace: (/graph_realtime.php[218]:rrdtool_function_graph(), /lib/rrd.php[1583]:rrd_substitute_host_query_data(), /lib/rrd.php[2515]:substitute_host_data(), /lib/variables.php[313]:get_uptime(), /lib/functions.php[5181]:get_daysfromtime(), /lib/functions.php[5203]:CactiErrorHandler())
08.02.2022 10:21:09 - ERROR PHP DEPRECATED: Implicit conversion from float 2741440.6 to int loses precision in file: /var/www/html/lib/functions.php on line: 5203
08.02.2022 10:21:09 - CMDPHP PHP ERROR Backtrace: (/graph_realtime.php[218]:rrdtool_function_graph(), /lib/rrd.php[1583]:rrd_substitute_host_query_data(), /lib/rrd.php[2515]:substitute_host_data(), /lib/variables.php[313]:get_uptime(), /lib/functions.php[5181]:get_daysfromtime(), /lib/functions.php[5203]:CactiErrorHandler())
08.02.2022 10:21:09 - ERROR PHP DEPRECATED: Implicit conversion from float 2741440.6 to int loses precision in file: /var/www/html/lib/functions.php on line: 5203
08.02.2022 10:21:09 - CMDPHP PHP ERROR Backtrace: (/graph_realtime.php[218]:rrdtool_function_graph(), /lib/rrd.php[1583]:rrd_substitute_host_query_data(), /lib/rrd.php[2515]:substitute_host_data(), /lib/variables.php[313]:get_uptime(), /lib/functions.php[5181]:get_daysfromtime(), /lib/functions.php[5203]:CactiErrorHandler())
08.02.2022 10:21:09 - ERROR PHP DEPRECATED: Implicit conversion from float 2741440.6 to int loses precision in file: /var/www/html/lib/functions.php on line: 5203
08.02.2022 10:21:09 - CMDPHP PHP ERROR Backtrace: (/graph_realtime.php[218]:rrdtool_function_graph(), /lib/rrd.php[1583]:rrd_substitute_host_query_data(), /lib/rrd.php[2515]:substitute_host_data(), /lib/variables.php[313]:get_uptime(), /lib/functions.php[5181]:get_daysfromtime(), /lib/functions.php[5203]:CactiErrorHandler())
08.02.2022 10:21:09 - ERROR PHP DEPRECATED: Implicit conversion from float 2741440.6 to int loses precision in file: /var/www/html/lib/functions.php on line: 5203
08.02.2022 10:21:09 - CMDPHP PHP ERROR Backtrace: (/graph_realtime.php[218]:rrdtool_function_graph(), /lib/rrd.php[1583]:rrd_substitute_host_query_data(), /lib/rrd.php[2515]:substitute_host_data(), /lib/variables.php[313]:get_uptime(), /lib/functions.php[5181]:get_daysfromtime(), /lib/functions.php[5203]:CactiErrorHandler())
08.02.2022 10:21:09 - ERROR PHP DEPRECATED: Implicit conversion from float 2741440.6 to int loses precision in file: /var/www/html/lib/functions.php on line: 5203
08.02.2022 10:21:09 - CMDPHP PHP ERROR Backtrace: (/graph_realtime.php[218]:rrdtool_function_graph(), /lib/rrd.php[1583]:rrd_substitute_host_query_data(), /lib/rrd.php[2515]:substitute_host_data(), /lib/variables.php[313]:get_uptime(), /lib/functions.php[5181]:get_daysfromtime(), /lib/functions.php[5203]:CactiErrorHandler())
08.02.2022 10:21:09 - ERROR PHP DEPRECATED: Implicit conversion from float 2741440.6 to int loses precision in file: /var/www/html/lib/functions.php on line: 5203
08.02.2022 10:21:09 - CMDPHP PHP ERROR Backtrace: (/graph_realtime.php[218]:rrdtool_function_graph(), /lib/rrd.php[1583]:rrd_substitute_host_query_data(), /lib/rrd.php[2515]:substitute_host_data(), /lib/variables.php[313]:get_uptime(), /lib/functions.php[5181]:get_daysfromtime(), /lib/functions.php[5203]:CactiErrorHandler())
08.02.2022 10:21:09 - ERROR PHP DEPRECATED: Implicit conversion from float 2741440.6 to int loses precision in file: /var/www/html/lib/functions.php on line: 5203
Desktop (please complete the following information)
OS: debian 11.2.0
php 8.1
Apache 2.4.52
10.5.12-MariaDB-0+deb11u1 Debian 11
installed on root directory instead of cacti
-cacti Version 1.2.20
Browser [e.g. chrome, safari]
chrome 98.0.4758.82
The text was updated successfully, but these errors were encountered: