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

    2.7.0.a.20221013.0600 haproxy php errors

    Scheduled Pinned Locked Moved CE 2.7.0 Development Snapshots (Retired)
    2 Posts 1 Posters 635 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.
    • A
      Anaerin
      last edited by Anaerin

      Attempting to upgrade and/or reinstall haproxy-devel (or haproxy) on the new 2.7.0.a.20221013.0600 build (having put off upgrading from the pre php upgrade 2.7.0 branch) gives the following error:

      >>> Installing pfSense-pkg-haproxy-devel... 
      Updating pfSense-core repository catalogue...
      pfSense-core repository is up to date.
      Updating pfSense repository catalogue...
      pfSense repository is up to date.
      All repositories are up to date.
      Checking integrity... done (0 conflicting)
      The following 3 package(s) will be affected (of 0 checked):
      
      New packages to be INSTALLED:
      	haproxy: 2.6.6 [pfSense]
      	lua53: 5.3.6 [pfSense]
      	pfSense-pkg-haproxy-devel: 0.62_11 [pfSense]
      
      Number of packages to be installed: 3
      
      The process will require 5 MiB more space.
      [1/3] Installing lua53-5.3.6...
      [1/3] Extracting lua53-5.3.6: ......... done
      [2/3] Installing haproxy-2.6.6...
      [2/3] Extracting haproxy-2.6.6: ........ done
      [3/3] Installing pfSense-pkg-haproxy-devel-0.62_11...
      [3/3] Extracting pfSense-pkg-haproxy-devel-0.62_11: .......... done
      Saving updated package information...
      done.
      Loading package configuration... done.
      Configuring package components...
      Loading package instructions...
      Custom commands...
      Executing custom_php_install_command()...
      Fatal error: Uncaught Error: Non-static method haproxy_utils::haproxy_hostname_get_prefix() cannot be called statically in /usr/local/pkg/haproxy/haproxy.inc:1284
      Stack trace:
      #0 /usr/local/pkg/haproxy/haproxy.inc(2195): write_backend('/var/etc/haprox...', Resource id #77, 'mail_ipvANY', Array, Array)
      #1 /usr/local/pkg/haproxy/haproxy.inc(2516): haproxy_writeconf('/var/etc/haprox...')
      #2 /usr/local/pkg/haproxy/haproxy.inc(702): haproxy_check_run(1)
      #3 /etc/inc/pkg-utils.inc(779) : eval()'d code(1): haproxy_custom_php_install_command()
      #4 /etc/inc/pkg-utils.inc(779): eval()
      #5 /etc/inc/pkg-utils.inc(897): eval_once('haproxy_custom_...')
      #6 /etc/rc.packages(76): install_package_xml('haproxy-devel')
      #7 {main}
        thrown in /usr/local/pkg/haproxy/haproxy.inc on line 1284
      PHP ERROR: Type: 1, File: /usr/local/pkg/haproxy/haproxy.inc, Line: 1284, Message: Uncaught Error: Non-static method haproxy_utils::haproxy_hostname_get_prefix() cannot be called statically in /usr/local/pkg/haproxy/haproxy.inc:1284
      Stack trace:
      #0 /usr/local/pkg/haproxy/haproxy.inc(2195): write_backend('/var/etc/haprox...', Resource id #77, 'mail_ipvANY', Array, Array)
      #1 /usr/local/pkg/haproxy/haproxy.inc(2516): haproxy_writeconf('/var/etc/haprox...')
      #2 /usr/local/pkg/haproxy/haproxy.inc(702): haproxy_check_run(1)
      #3 /etc/inc/pkg-utils.inc(779) : eval()'d code(1): haproxy_custom_php_install_command()
      #4 /etc/inc/pkg-utils.inc(779): eval()
      #5 /etc/inc/pkg-utils.inc(897): eval_once('haproxy_custom_...')
      #6 /etc/rc.packages(76): install_package_xml('haproxy-devel')
      #7 {main}
        thrownpkg-static: POST-INSTALL script failed
      pkg-static: Fail to kill all processes:No such process
      >>> Cleaning up cache... done.
      Success
      

      Any steps to bugfix, because at this point haproxy is irrevocably broken?

      [edit] Ticket raised: https://redmine.pfsense.org/issues/13562

      A 1 Reply Last reply Reply Quote 0
      • A
        Anaerin @Anaerin
        last edited by

        Okay, having done a little digging, and hand-editing, I have haproxy running in a very quick and dirty way.
        First I edited /usr/local/pkg/haproxy/haproxy.inc and changed lines 1284, 1285 and 1298 to:

                                $serverprefix = (new haproxy_utils)->haproxy_hostname_get_prefix($be['address']);
                                $serveraddress = (new haproxy_utils)->haproxy_hostname_strip_prefix($be['address']);
                                if ($addrprefix && $serverprefix && $serverprefix !== $addrprefix) {
                                        continue; // skip the server if its not 'usable' in this transparent-backend
                                }
                                if ($be['forwardto'] && $be['forwardto'] != "") {
                                        $unix_socket = true;
                                        $servers[] = "/{$be['forwardto']}.socket send-proxy-v2-ssl-cn";
                                } else {
                                        if (in_array($serverprefix, array('unix@'))) {
                                                $servers[] = $serveraddress;
                                        } elseif (is_ipaddr($serveraddress) || $use_haproxyresolvers) {
                                                $servers[] = $serveraddress;
                                        } elseif (is_hostname($serveraddress)) {
                                                $dnsresult_servers = (new haproxy_utils)->query_dns($serveraddress, $dnsquerytype);
        

        (The change is to replace haproxy_utils:: with (new haproxy_utils)-> which seems to work just fine)

        I'll also note this in the ticket.

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