Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    23.05.1: PHP Fatal error: Uncaught TypeError: Unsupported operand types

    Scheduled Pinned Locked Moved General pfSense Questions
    18 Posts 6 Posters 2.8k Views
    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.
    • SuikaS
      Suika
      last edited by

      Crash report begins.  Anonymous machine information:
      
      amd64
      14.0-CURRENT
      FreeBSD 14.0-CURRENT #1 plus-RELENG_23_05_1-n256108-459fc493a87: Wed Jun 28 04:26:04 UTC 2023     root@freebsd:/var/jenkins/workspace/pfSense-Plus-snapshots-23_05_1-main/obj/amd64/f2Em2w3l/var/jenkins/workspace/pfSense-Plus-snapshots-23_05_1-main/sources/
      
      Crash report details:
      
      PHP Errors:
      [16-Jul-2023 19:44:14 Etc/UTC] PHP Fatal error:  Uncaught TypeError: Unsupported operand types: string / int in /etc/inc/util.inc:2479
      Stack trace:
      #0 /etc/inc/pfsense-utils.inc(2013): get_memory()
      #1 /etc/inc/filter.inc(510): pfsense_default_state_size()
      #2 /etc/rc.filter_configure_sync(32): filter_configure_sync()
      #3 {main}
        thrown in /etc/inc/util.inc on line 2479
      
      

      Keeps happening every other day, does not cause any issues that I can notice.
      This is a non-netgate white box system that had 2.6 CE installed, upgraded to 23.01 and had a configuration backup imported from another system that also ran 23.01. From there it was upgraded continuously to 23.05.1.

      In versions prior to 23.05.1 the error that appeared was this, but I no longer remember what exact version it was:

      [03-Jun-2023 16:09:02 Etc/UTC] PHP Fatal error:  Uncaught DivisionByZeroError: Division by zero in /usr/local/www/includes/functions.inc.php:219
      Stack trace:
      #0 /usr/local/www/includes/functions.inc.php(33): mem_usage()
      #1 /usr/local/www/getstats.php(40): get_stats(Array)
      #2 {main}
        thrown in /usr/local/www/includes/functions.inc.php on line 219
      

      But since it was related stats, I did not really care about it.

      1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

        @Suika said in 23.05.1: PHP Fatal error: Uncaught TypeError: Unsupported operand types:

        /etc/inc/util.inc:2479

        Hmm that's in:

        function get_memory() {
        	$physmem = get_single_sysctl("hw.physmem");
        	$realmem = get_single_sysctl("hw.realmem");
        	/* convert from bytes to megabytes */
        	return array(($physmem/1048576), ($realmem/1048576));
        }
        

        Do those sysctls exist on your system?

        [23.05.1-RELEASE][admin@fw1.stevew.lan]/root: sysctl hw.physmem
        hw.physmem: 2125135872
        [23.05.1-RELEASE][admin@fw1.stevew.lan]/root: sysctl hw.realmem
        hw.realmem: 2147479552
        

        Steve

        SuikaS 1 Reply Last reply Reply Quote 0
        • SuikaS
          Suika @stephenw10
          last edited by

          @stephenw10 said in 23.05.1: PHP Fatal error: Uncaught TypeError: Unsupported operand types:

          Do those sysctls exist on your system?

          [23.05.1-RELEASE][suika@pfSense.pfsense.lan]/home/suika: sysctl hw.physmem
          hw.physmem: 8288366592
          [23.05.1-RELEASE][suika@pfSense.pfsense.lan]/home/suika: sysctl hw.realmem
          hw.realmem: 8589934592
          
          1 Reply Last reply Reply Quote 0
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by

            Does it happen when doing anything in particular? Can you trigger it on demand?

            SuikaS 1 Reply Last reply Reply Quote 0
            • SuikaS
              Suika @stephenw10
              last edited by Suika

              @stephenw10 said in 23.05.1: PHP Fatal error: Uncaught TypeError: Unsupported operand types:

              Does it happen when doing anything in particular? Can you trigger it on demand?

              It happens when doing nothing in particular. It just happens in the background. I can wipe the crash report and accept the notification. And then the next day it will happen again. And no, can't trigger it, since I do not even know what part of the UI or job in the background triggers it.
              Also, just noticed, there is an older report:

              Crash report begins.  Anonymous machine information:
              
              amd64
              14.0-CURRENT
              FreeBSD 14.0-CURRENT #1 plus-RELENG_23_05_1-n256108-459fc493a87: Wed Jun 28 04:26:04 UTC 2023     root@freebsd:/var/jenkins/workspace/pfSense-Plus-snapshots-23_05_1-main/obj/amd64/f2Em2w3l/var/jenkins/workspace/pfSense-Plus-snapshots-23_05_1-main/sources/
              
              Crash report details:
              
              PHP Errors:
              [16-Jul-2023 19:44:14 Etc/UTC] PHP Fatal error:  Uncaught TypeError: Unsupported operand types: string / int in /etc/inc/util.inc:2479
              Stack trace:
              #0 /etc/inc/pfsense-utils.inc(2013): get_memory()
              #1 /etc/inc/filter.inc(510): pfsense_default_state_size()
              #2 /etc/rc.filter_configure_sync(32): filter_configure_sync()
              #3 {main}
                thrown in /etc/inc/util.inc on line 2479
              [27-Jul-2023 21:20:37 Etc/UTC] PHP Fatal error:  Uncaught TypeError: Unsupported operand types: string / int in /etc/inc/util.inc:2479
              Stack trace:
              #0 /etc/inc/pfsense-utils.inc(2013): get_memory()
              #1 /usr/local/www/includes/functions.inc.php(104): pfsense_default_state_size()
              #2 /usr/local/www/includes/functions.inc.php(35): get_pfstate()
              #3 /usr/local/www/getstats.php(40): get_stats(Array)
              #4 {main}
                thrown in /etc/inc/util.inc on line 2479
              
              
              
              No FreeBSD crash data found.
              
              1 Reply Last reply Reply Quote 0
              • stephenw10S
                stephenw10 Netgate Administrator
                last edited by

                https://redmine.pfsense.org/issues/14648

                1 Reply Last reply Reply Quote 0
                • SuikaS
                  Suika
                  last edited by

                  @stephenw10 said in 23.05.1: PHP Fatal error: Uncaught TypeError: Unsupported operand types:

                  https://redmine.pfsense.org/issues/14648

                  Checked with a friend of mine that runs similar device but has a clean setup with no migrations. From the looks of it, he used some old 2.7 beta and gone to latest plus version. No crashes there.
                  So I guess it has something to do with the imported config in between the two 23.01 instances and an upgrade to higher version. Altho how it leads to a non-numeric string being returned from sysctl is a mystery.

                  1 Reply Last reply Reply Quote 0
                  • stephenw10S
                    stephenw10 Netgate Administrator
                    last edited by

                    Indeed there seems to be something unique in your config since there have been many thousands of successful upgrades from 23.01 that don't hit it. Including the many upgrades I've run myself.

                    1 Reply Last reply Reply Quote 0
                    • D
                      darkphox
                      last edited by darkphox

                      @Suika, I'm curious what device you're running on? I get the same exact error on a new N305 device after importing a config from my old J4125 system.

                      I've been running my old device concurrent with the new one while I tried all sorts of things. It ran for a full 24 hours with nothing connected except the WAN. It had no issues, so I think I've ruled out general background processes. I connected it to my LAN switch tonight and I got the error within an hour. It's the same exact error as yours as far as I can tell.

                      PHP Errors:
                      [14-Aug-2023 17:25:56 US/Central] PHP Fatal error:  Uncaught TypeError: Unsupported operand types: string / int in /etc/inc/util.inc:2479
                      Stack trace:
                      #0 /etc/inc/pfsense-utils.inc(2013): get_memory()
                      #1 /usr/local/www/includes/functions.inc.php(104): pfsense_default_state_size()
                      #2 /usr/local/www/includes/functions.inc.php(35): get_pfstate()
                      #3 /usr/local/www/getstats.php(40): get_stats(Array)
                      #4 {main}
                        thrown in /etc/inc/util.inc on line 2479
                      

                      I tried removing the system info widget from my dashboard in case it was something related to pulling memory usage, but that made no difference. The only constant is that it comes up after loading a config from the old device, but it doesn't seem to matter what version the backup was made on. I've made a backup from the 4125 system running 23.05.1 and loaded it onto the N305, also running 23.05.1, and it still creeps in.

                      I'm going to try the patch in the redmine mentioned above. Will follow up if I find any other clues.

                      B 1 Reply Last reply Reply Quote 0
                      • S
                        serbus
                        last edited by

                        Hello!
                        Maybe not following the patch correctly in util.inc ...

                        /* If both are invalid, something deeper is wrong */
                        	if (!is_numericint($physmem) &&
                        	    is_numericint($realmem)) {
                        

                        should be...

                        /* If both are invalid, something deeper is wrong */
                        	if (!is_numericint($physmem) &&
                        	    !is_numericint($realmem)) {
                        

                        ???

                        John

                        Lex parsimoniae

                        1 Reply Last reply Reply Quote 0
                        • stephenw10S
                          stephenw10 Netgate Administrator
                          last edited by

                          You should ask that on the bug report: https://redmine.pfsense.org/issues/14648

                          1 Reply Last reply Reply Quote 0
                          • B
                            Beluga @darkphox
                            last edited by

                            @darkphox

                            I think I have the same issue.

                            Went from a i5 6500 to a J4025 and now (2 days ago) I got a asrock n100m....

                            From the i5 6500 to the J4025 no issues (but 2 cores was not enough, so now the new one)
                            But now I get this errors.

                            Switched some hardware - still same issue.

                            Tryed reinstalling all packages - did not help. (now i'm rocking only Avahi)
                            But I figured out when I get the error - when the system is under heavy(long) load (downloading a big game).

                            My 2 errors:
                            Untitled2.png

                            Vudx1dunIPRfThH1JigXe8MY.png

                            Now i'm thinking of reinstalling everything - fresh.
                            But aybe somebody else tried that already?

                            1 Reply Last reply Reply Quote 0
                            • B
                              Beluga
                              last edited by

                              Oke I did the redmine thing aswell - looks like its solve?
                              It was very scary for me, i'm a n00b at this (starded this year with pfsense - 9 out of 10 times I have no idea what i'm doing.
                              Also english is not my native language - so not easy hahah

                              But much awesome!

                              1 Reply Last reply Reply Quote 1
                              • S
                                svsnead
                                last edited by

                                I have the same error and mine came with 23.01 and I upgraded to 23.05. It had and error before and 23.05 did not fix it.

                                Crash report begins. Anonymous machine information:

                                amd64
                                14.0-CURRENT
                                FreeBSD 14.0-CURRENT #1 plus-RELENG_23_05_1-n256108-459fc493a87: Wed Jun 28 04:26:04 UTC 2023 root@freebsd:/var/jenkins/workspace/pfSense-Plus-snapshots-23_05_1-main/obj/amd64/f2Em2w3l/var/jenkins/workspace/pfSense-Plus-snapshots-23_05_1-main/sources/

                                Crash report details:

                                PHP Errors:
                                [19-Oct-2023 16:36:06 US/Pacific] PHP Fatal error: Uncaught TypeError: Unsupported operand types: string / int in /etc/inc/util.inc:2479
                                Stack trace:
                                #0 /etc/inc/pfsense-utils.inc(2013): get_memory()
                                #1 /usr/local/www/includes/functions.inc.php(104): pfsense_default_state_size()
                                #2 /usr/local/www/includes/functions.inc.php(46): get_pfstate(true)
                                #3 /usr/local/www/getstats.php(40): get_stats(Array)
                                #4 {main}
                                thrown in /etc/inc/util.inc on line 2479
                                [20-Oct-2023 14:18:20 US/Pacific] PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /usr/local/www/includes/functions.inc.php:219
                                Stack trace:
                                #0 /usr/local/www/includes/functions.inc.php(33): mem_usage()
                                #1 /usr/local/www/getstats.php(40): get_stats(Array)
                                #2 {main}
                                thrown in /usr/local/www/includes/functions.inc.php on line 219

                                No FreeBSD crash data found.

                                1 Reply Last reply Reply Quote 0
                                • stephenw10S
                                  stephenw10 Netgate Administrator
                                  last edited by

                                  Did you try the patch on the bug report?: https://redmine.pfsense.org/issues/14648

                                  What hardware is that?

                                  Steve

                                  1 Reply Last reply Reply Quote 0
                                  • S
                                    svsnead
                                    last edited by

                                    Hmmmm I just update it to 23.05. I will need to setup how to apply a patch. The hardware is a MOGINSOK N100.

                                    Steven V. Snead, MCSE, CCNA

                                    1 Reply Last reply Reply Quote 0
                                    • stephenw10S
                                      stephenw10 Netgate Administrator
                                      last edited by

                                      23.05.1 is the current version. 23.09-beta is available.

                                      However that is a known bug that we have not yet been able to replicate. It seems to affect only some devices. The patch on the bug report mitigates the issue.

                                      Steve

                                      1 Reply Last reply Reply Quote 0
                                      • S
                                        svsnead
                                        last edited by

                                        Thanks for the info. This is my first time setting up a pfsense. I have been using Sonicwall for years. Site to Site VPN seems to work good with ipsec.

                                        Steven V. Snead, MCSE, CCNA

                                        1 Reply Last reply Reply Quote 0
                                        • First post
                                          Last post
                                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.