Navigation

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

    PHP Error on status_interfaces.php from PPP uptime

    webGUI
    2
    6
    70
    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.
    • R
      root32 last edited by

      Hi,

      I have a similar error on the status page:

      Crash report begins.  Anonymous machine information:
      
      amd64
      14.0-CURRENT
      FreeBSD 14.0-CURRENT #0 plus-RELENG_23_01-n256037-6e914874a5e: Fri Feb 10 20:30:29 UTC 2023     root@freebsd:/var/jenkins/workspace/pfSense-Plus-snapshots-23_01-main/obj/amd64/VDZvZksF/var/jenkins/workspace/pfSense-Plus-snapshots-23_01-main/sources/FreeBS
      
      Crash report details:
      
      PHP Errors:
      [16-Mar-2023 00:56:47 Europe/Berlin] PHP Fatal error:  Uncaught TypeError: Unsupported operand types: int + string in /etc/inc/pfsense-utils.inc:1585
      Stack trace:
      #0 /etc/inc/pfsense-utils.inc(1774): get_ppp_uptime('ppp0')
      #1 /usr/local/www/status_interfaces.php(126): get_interface_info('opt2')
      #2 {main}
        thrown in /etc/inc/pfsense-utils.inc on line 1585
      [16-Mar-2023 01:07:35 Europe/Berlin] PHP Fatal error:  Uncaught TypeError: Unsupported operand types: int + string in /etc/inc/pfsense-utils.inc:1586
      Stack trace:
      #0 /etc/inc/pfsense-utils.inc(1775): get_ppp_uptime('ppp0')
      #1 /usr/local/www/status_interfaces.php(126): get_interface_info('opt2')
      #2 {main}
        thrown in /etc/inc/pfsense-utils.inc on line 1586
      [16-Mar-2023 01:10:42 Europe/Berlin] PHP Fatal error:  Uncaught TypeError: Unsupported operand types: int + string in /etc/inc/pfsense-utils.inc:1585
      Stack trace:
      #0 /etc/inc/pfsense-utils.inc(1774): get_ppp_uptime('ppp0')
      #1 /usr/local/www/status_interfaces.php(126): get_interface_info('opt2')
      #2 {main}
        thrown in /etc/inc/pfsense-utils.inc on line 1585
      
      
      
      No FreeBSD crash data found.
      			
      
      jimp 2 Replies Last reply Reply Quote 0
      • jimp
        jimp Rebel Alliance Developer Netgate @root32 last edited by

        @root32 said in Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/status_interfaces.php:137:

        Hi,

        I have a similar error on the status page:

        Crash report begins.  Anonymous machine information:
        
        amd64
        14.0-CURRENT
        FreeBSD 14.0-CURRENT #0 plus-RELENG_23_01-n256037-6e914874a5e: Fri Feb 10 20:30:29 UTC 2023     root@freebsd:/var/jenkins/workspace/pfSense-Plus-snapshots-23_01-main/obj/amd64/VDZvZksF/var/jenkins/workspace/pfSense-Plus-snapshots-23_01-main/sources/FreeBS
        
        Crash report details:
        
        PHP Errors:
        [16-Mar-2023 00:56:47 Europe/Berlin] PHP Fatal error:  Uncaught TypeError: Unsupported operand types: int + string in /etc/inc/pfsense-utils.inc:1585
        Stack trace:
        #0 /etc/inc/pfsense-utils.inc(1774): get_ppp_uptime('ppp0')
        #1 /usr/local/www/status_interfaces.php(126): get_interface_info('opt2')
        #2 {main}
          thrown in /etc/inc/pfsense-utils.inc on line 1585
        [16-Mar-2023 01:07:35 Europe/Berlin] PHP Fatal error:  Uncaught TypeError: Unsupported operand types: int + string in /etc/inc/pfsense-utils.inc:1586
        Stack trace:
        #0 /etc/inc/pfsense-utils.inc(1775): get_ppp_uptime('ppp0')
        #1 /usr/local/www/status_interfaces.php(126): get_interface_info('opt2')
        #2 {main}
          thrown in /etc/inc/pfsense-utils.inc on line 1586
        [16-Mar-2023 01:10:42 Europe/Berlin] PHP Fatal error:  Uncaught TypeError: Unsupported operand types: int + string in /etc/inc/pfsense-utils.inc:1585
        Stack trace:
        #0 /etc/inc/pfsense-utils.inc(1774): get_ppp_uptime('ppp0')
        #1 /usr/local/www/status_interfaces.php(126): get_interface_info('opt2')
        #2 {main}
          thrown in /etc/inc/pfsense-utils.inc on line 1585
        
        
        
        No FreeBSD crash data found.
        			
        

        That is a much different error from a much different cause. I'm going to split this off into its own thread.

        Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • jimp
          jimp Rebel Alliance Developer Netgate @root32 last edited by

          @root32 If you go to Diagnostics > Command Prompt and run this in the PHP Execute box, what does it return?

          var_dump( get_ppp_uptime('ppp0') );
          

          Though I'm not seeing anything on the exact lines in question in the error that would be adding an int and string, it's all just string concatenation.

          Do you have any patches or third party/non-standard packages on there?

          Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

          Need help fast? Netgate Global Support!

          Do not Chat/PM for help!

          1 Reply Last reply Reply Quote 0
          • jimp
            jimp Rebel Alliance Developer Netgate last edited by

            I suspect the following patch will fix it but since I can't reproduce it here I can't be sure.

            diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc
            index 25667356c1..61ce32153d 100644
            --- a/src/etc/inc/pfsense-utils.inc
            +++ b/src/etc/inc/pfsense-utils.inc
            @@ -1521,7 +1521,7 @@ function get_ppp_uptime($port) {
                            $uptime_data = explode("\n", $saved_time);
                            $sec = 0;
                            foreach ($uptime_data as $upt) {
            -                       $sec += substr($upt, 1 + strpos($upt, " "));
            +                       $sec += (int) substr($upt, 1 + strpos($upt, " "));
                            }
                            return convert_seconds_to_dhms($sec);
                    } else {
            

            You can install the System Patches package and then create an entry for that diff to apply the fix.

            Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

            1 Reply Last reply Reply Quote 1
            • jimp
              jimp Rebel Alliance Developer Netgate last edited by

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

              Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

              Need help fast? Netgate Global Support!

              Do not Chat/PM for help!

              1 Reply Last reply Reply Quote 0
              • R
                root32 last edited by root32

                Hi,

                thanks a lot for your support, I made the change in the file and it is working :-)

                @jimp said in PHP Error on status_interfaces.php from PPP uptime:

                @root32 If you go to Diagnostics > Command Prompt and run this in the PHP Execute box, what does it return?

                var_dump( get_ppp_uptime('ppp0') );
                

                Though I'm not seeing anything on the exact lines in question in the error that would be adding an int and string, it's all just string concatenation.

                Do you have any patches or third party/non-standard packages on there?

                In the case you still need the information:

                string(13) "386d 15:19:41"
                
                1 Reply Last reply Reply Quote 0
                • First post
                  Last post