Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Register
    • Login
    Introducing Netgate Nexus: Multi-Instance Management at Your Fingertips.

    Unable to load firewall rules.

    Scheduled Pinned Locked Moved webGUI
    3 Posts 3 Posters 200 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V
      VersatusOmni
      last edited by VersatusOmni

      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 below

      function 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. šŸ˜„

      SteveITSS GertjanG 2 Replies Last reply
      Reply Quote 0
      • SteveITSS
        SteveITS Galactic Empire @VersatusOmni
        last edited by

        @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…

        To upgrade, select your branch in System/Update/Update Settings. When upgrading, allow 10-15 minutes to reboot, or more depending on packages, CPU, and/or disk speed.
        Only install packages for your version of pfSense.
        Upvote šŸ‘ helpful posts!

        1 Reply Last reply
        Reply Quote 0
        • GertjanG
          Gertjan @VersatusOmni
          last edited by

          @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 :

          498788c3-5425-4632-abec-c6aaa04487d2-image.png

          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 ?

          No "help me" PM's please. Use the forum, the community will thank you.

          1 Reply Last reply
          Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better šŸ’—

          Register Login
          • First post
            Last post
          Copyright 2026 Rubicon Communications LLC (Netgate). All rights reserved.
          Privacy Policy · Cookie Policy