Unable to load firewall rules.
-
When I try to load/view the firewall rules, it crashes with 50x error code,
PHP ERROR: Type: 1, File: /etc/inc/util.inc, Line: 3412, Message: Uncaught TypeError: format_number(): Argument #1 ($num) must be of type int, float given, called in /usr/local/www/firewall_rules.php on line 125 and defined in /etc/inc/util.inc:3412 Stack trace: #0 /usr/local/www/firewall_rules.php(125): format_number() #1 /usr/local/www/firewall_rules.php(534): print_states() #2 {main}I did some digging into this, and found that the format_number function from
/etc/inc/util.inc
expects an int, and a precision as an int. It seems very odd to me that it would need a precision value, it it only accepts an int. That, combined with the fact that it is being passed a float, which is what causes this crash makes me think that this is a bug in that function. the full function is belowfunction format_number(int $num, int $precision = 3): string { $units = ['', 'K', 'M', 'G', 'T']; for ($i = 0; $num >= 1000; $i++) { $num /= 1000; } return (round($num, $precision) . $units[$i]); }I was going to submit a bug report, but when I looked up where to do so, I was adamantly informed that I needed to post here first.

-
@VersatusOmni hmm havenāt run into this. Isnāt $num in bytes? Not sure how that gets to be a float. If you reboot or otherwise clear states I bet it disappearsā¦
-
@VersatusOmni said in Unable to load firewall rules.:
and found that the format_number function from
?
A couple of days (week ?) ago, there was an issue with the number_format(), and now also the format_number() function. What a coincidence./usr/local/www/firewall_rules.php on line 125 ; $evaluations , and also $states, can / is only be an int, not a float.
It's the format_number() function that makes :

for example, see the "evaluation: 1.06M" line.
The real content of $evaluation (for me, right now) was 1061123, and this an int, as the number of evaluation can only be an int. states also.What pfSense version are you using ?
edit : or did you manage to create more evaluations then that what can be hold in an int ?
Privacy Policy · Cookie Policy