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

PHP ERROR: Type: 1

Scheduled Pinned Locked Moved General pfSense Questions
16 Posts 4 Posters 773 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.
  • D
    DavcoreTech
    last edited by DavcoreTech Dec 21, 2024, 12:46 AM Dec 21, 2024, 12:45 AM

    Can someone explain what error is this?, lately im getting this error.

    21:30:27 PHP ERROR: Type: 1, File: /etc/inc/captiveportal.inc, Line: 1746, Message: 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

    G 1 Reply Last reply Dec 23, 2024, 10:46 AM Reply Quote 0
    • S
      stephenw10 Netgate Administrator
      last edited by Dec 21, 2024, 2:23 AM

      It's an invalid value in the captive portal setup.

      What pfSense version is that?

      D 1 Reply Last reply Dec 21, 2024, 2:35 AM Reply Quote 0
      • D
        DavcoreTech @stephenw10
        last edited by Dec 21, 2024, 2:35 AM

        @stephenw10 this is the version.

        f9eb94ca-1424-4854-bdc4-165547285749-image.png

        1 Reply Last reply Reply Quote 0
        • S
          stephenw10 Netgate Administrator
          last edited by Dec 21, 2024, 12:59 PM

          Ok, what is your CP setup? Do you have a custom login page etc?

          D 1 Reply Last reply Dec 21, 2024, 9:01 PM Reply Quote 0
          • S
            stephenw10 Netgate Administrator
            last edited by Dec 21, 2024, 1:06 PM

            That line is selecting the interface(s) the CP zone is running on. Do you have some unusual or old/invalid interface set?

            L 1 Reply Last reply Dec 21, 2024, 3:17 PM Reply Quote 0
            • L
              Luca De Andreis @stephenw10
              last edited by Luca De Andreis Dec 21, 2024, 3:19 PM Dec 21, 2024, 3:17 PM

              @stephenw10

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

              Applied in changeset 64075a4359d070c300e09a94c2cf1f4854ce649b

              D 1 Reply Last reply Dec 21, 2024, 9:04 PM Reply Quote 1
              • D
                DavcoreTech @stephenw10
                last edited by Dec 21, 2024, 9:01 PM

                @stephenw10 we have a custom html captive portal uploaded on pfsense machine,

                1 Reply Last reply Reply Quote 0
                • D
                  DavcoreTech @Luca De Andreis
                  last edited by DavcoreTech Dec 21, 2024, 9:05 PM Dec 21, 2024, 9:04 PM

                  @Luca-De-Andreis so we will wait for the update?, thats a weird bug, thank god the captive portal still works fine.

                  L 1 Reply Last reply Dec 21, 2024, 9:06 PM Reply Quote 0
                  • L
                    Luca De Andreis @DavcoreTech
                    last edited by Dec 21, 2024, 9:06 PM

                    @DavcoreTech
                    Apply patch 64075a4359d070c300e09a94c2cf1f4854ce649b solves the problem.

                    1 Reply Last reply Reply Quote 0
                    • S
                      stephenw10 Netgate Administrator
                      last edited by Dec 21, 2024, 10:29 PM

                      @Luca-De-Andreis said in PHP ERROR: Type: 1:

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

                      Yup you can just apply the fix as a patch using the System Patches package.

                      1 Reply Last reply Reply Quote 0
                      • G
                        Gertjan @DavcoreTech
                        last edited by Dec 23, 2024, 10:46 AM

                        @DavcoreTech said in PHP ERROR: Type: 1:

                        #3 /usr/local/captiveportal/index.php(60): portal_reply_page()

                        The error start here : on line 60.
                        reply_pages() is called, because the test "empty($cpcfg))" failed.
                        This test fails if a portal user types in manually a http(s) URL to access the login page.
                        This should never be needed, and if done, the URL has to be corecly 'formatted', that is, it should contain a parameter like "https://portal.your-domaine.tld:8003/index.php?zone=cpzone1" where cpzone1 must be valid : it must exist in the config.xml as a portal settings block.

                        When "https://portal.your-domaine.tld:8003" is used, there is no $cpzone parameter.
                        Thus the test in index.php "empty($cpcfg)" fails. And then "reply_pages()" (line 60) is called which needs a valid $cpzone, as it is using it without prior testing.
                        Result : Booomm (PHP error).

                        Again : normally, this error can't really happen, as who is entering a wrong portal access URL anyway ? Nobody should need to do this. But, apparently, people do it anyway (can some one tell me why ??)

                        I don't fully understand the patch :

                        https://redmine.pfsense.org/projects/pfsense/repository/2/revisions/64075a4359d070c300e09a94c2cf1f4854ce649b/diff/src/etc/inc/captiveportal.inc

                        as in this context, $cpzone is undefined ....

                        The real ? better ? solution would be :

                        8c8960b6-37ec-4170-a1cd-87e0f627372c-image.png

                        Btw : see also here - as discovered a while ago.

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

                        D 1 Reply Last reply Dec 23, 2024, 10:55 AM Reply Quote 0
                        • D
                          DavcoreTech @Gertjan
                          last edited by Dec 23, 2024, 10:55 AM

                          @Gertjan same i dont know how to add the patch, is there a tutprial?

                          G 1 Reply Last reply Dec 23, 2024, 12:22 PM Reply Quote 0
                          • G
                            Gertjan @DavcoreTech
                            last edited by Dec 23, 2024, 12:22 PM

                            @DavcoreTech

                            Install it :

                            22e71f49-0920-48f8-8522-8f377c22ef47-image.png

                            Then: here it is : System > Patches

                            Go for teh 9a103925-0894-4e75-bbec-260b5c0fd15e-image.png

                            button.

                            As you have the patch ID : here :

                            851e6bda-9b6c-4dd1-a9cd-733250a0c628-image.png

                            use that, and enter a useful patch description, so you'll know later on where you got it from :

                            6b962d6f-208f-410b-b321-e94536c75635-image.png

                            and then the big bleu Save button at the bottom.

                            Now you see this :

                            cbb29c51-4ae4-47ea-89ea-fabb7983982a-image.png

                            Do what is proposd : fetch the patch ! ( Click on the bleu Fetch ).

                            fd7acab4-3eeb-4ef9-a89d-7dffe5cfd042-image.png

                            Now you should be able to see a bleu Apply button.
                            I don't have that button, as I solved this issue using another method.

                            There is also the manual method, and for this you need a text editor.
                            As the actual change is : change [] for "" on line 1746 in the fiel /etc/inc/captiveportal.inc

                            I'm not sure if this actually resolves the issue - see above for my motivation.

                            And again, : normally, this PHP error isn't actually a bug, but also a feature, as it shows something is wrong with the (your) portal usage.
                            Nobody should enter the captive portal login manually. It's like email addresses and phone number : don't enter them manually as chances are great you do it wrong.
                            I'm using the portal for more then a decade now, never had to enter the URL 'by hand'.

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

                            D L 2 Replies Last reply Dec 25, 2024, 1:45 AM Reply Quote 1
                            • D
                              DavcoreTech @Gertjan
                              last edited by Dec 25, 2024, 1:45 AM

                              @Gertjan thank you, already apply the patch hopefully if will be solve,

                              1 Reply Last reply Reply Quote 1
                              • L
                                Luca De Andreis @Gertjan
                                last edited by Jan 12, 2025, 8:38 PM

                                @Gertjan

                                Sorry, I use the custom patch for...
                                https://redmine.pfsense.org/issues/15907
                                .. and seems works fine.

                                But is not included in patch 2.2.20 ?

                                For now I use 2.2.20 and the custom patch... 2.2.20 has release few days ago but non included this patch.

                                86022bd2-62e4-4a66-bcc2-6cb82d8fa1e7-immagine.png

                                G 1 Reply Last reply Jan 13, 2025, 8:31 AM Reply Quote 0
                                • G
                                  Gertjan @Luca De Andreis
                                  last edited by Jan 13, 2025, 8:31 AM

                                  @Luca-De-Andreis said in PHP ERROR: Type: 1:

                                  But is not included in patch 2.2.20 ?

                                  Look at the list below :

                                  9ea6961b-6665-46e5-be14-fecf558e7c26-image.png

                                  You can believe your iwn eyes : if it isn't there ... it isn't there 😊

                                  A little bit to late to be included in 2.2.20, or it isn't an an 'important' patch as this issue can't happen, as humans shouldn't enter the portal URL manually. And if they do, they shouldn't make errors when typing it in (I know, they will make errors).
                                  Portal user have to enter the URL them selves on your portal ?

                                  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 0
                                  • First post
                                    Last post
                                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                                    This community forum collects and processes your personal information.
                                    consent.not_received