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

    PHP Fatal error: Uncaught TypeError in /etc/inc/captiveportal.inc

    Scheduled Pinned Locked Moved Captive Portal
    5 Posts 4 Posters 627 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.
    • G
      GeorgeCZ58
      last edited by

      Never had such issue before. Can somebody explain why that happen? And is that some bug? How to mitigate the issue?

      Crash report begins. Anonymous machine information:

      amd64
      15.0-CURRENT
      FreeBSD 15.0-CURRENT #0 plus-RELENG_24_11-cxcxcxcxcxcx: Fri Nov 22 05:08:46 UTC 2024 root@freebsd:/var/jenkins/workspace/pfSense-Plus-snapshots-24_11-main/obj/amd64/AKWlAIiM/var/jenkins/workspace/pfSense-Plus-snapshots-24_11-main/sources/FreeBS

      Crash report details:

      PHP Errors:
      [03-Feb-2025 15:10:01 Europe/Paris] PHP Fatal error: Uncaught TypeError: explode(): Argument #2 ($string) must be of type string, array given in /etc/inc/captiveportal.inc:1746
      Stack trace:
      #0 /etc/inc/captiveportal.inc(1746): explode()
      #1 /etc/inc/captiveportal.inc(1802): portal_ip_from_client_ip()
      #2 /etc/inc/captiveportal.inc(1823): portal_hostname_from_client_ip()
      #3 /usr/local/captiveportal/index.php(60): portal_reply_page()
      #4 {main}
      thrown in /etc/inc/captiveportal.inc on line 1746

      GertjanG 1 Reply Last reply Reply Quote 0
      • M
        marcosm Netgate
        last edited by marcosm

        It's been fixed, see https://redmine.pfsense.org/issues/15907

        You may manually apply the fix using the System Patches package, see: https://docs.netgate.com/pfsense/en/latest/development/system-patches.html

        G 1 Reply Last reply Reply Quote 0
        • G
          GeorgeCZ58 @marcosm
          last edited by

          @marcosm said in PHP Fatal error: Uncaught TypeError in /etc/inc/captiveportal.inc:

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

          All patches are already applied. But this seems is not fixed in any patch.. ?

          patient0P 1 Reply Last reply Reply Quote 0
          • patient0P
            patient0 @GeorgeCZ58
            last edited by

            @GeorgeCZ58 said in PHP Fatal error: Uncaught TypeError in /etc/inc/captiveportal.inc:

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

            If you check the issue you see an "Associated revisions" tab (direct link: https://redmine.pfsense.org/issues/15907?tab=changesets) below the yellow bug description.

            There you'll find the revision, in this case 64075a4359d070c300e09a94c2cf1f4854ce649b.

            Then follow the "Adding a Custom Patch" documentation linked above by @marcosm.

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

              @GeorgeCZ58 said in PHP Fatal error: Uncaught TypeError in /etc/inc/captiveportal.inc:

              Can somebody explain why that happen?

              Are you sure ? 😊

              A portal user entered (with the keyboard) the URL manually, and forgot to add a mandatory paramter.
              He/she was using an URL like
              https://your-portal.your-hostname.tld:8003/
              which would work, as /index.php would be tried by the browser.
              Or
              https://your-portal.your-hostname.tld:8003/index.php
              Better, but it will fail as
              https://your-portal.your-hostname.tld:8003/index.php?zone=CPZONE1
              The zone paramter has to be present, with a valid ID so 'pfSense' knows what portal instance is accessed.
              A valid ID is this :

              efdc8fa7-cefc-4e7b-a920-6d332d9ff8fd-image.png

              without it, the PHP triggers.
              The thing is, the fact that it is wrong or absent is detected. The portal user will receives a html page telling that an error happened. But to make this html page, the zone paramter is used, ..... and it was not there. => bug.

              Again, normally, this can't happen.
              Nobody has to or should type in manually the rather cryptic login URL ......

              No "help me" PM's please. Use the forum, the community will thank you.
              Edit : and where are the logs ??

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