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 1.2k 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.
    • stephenw10S
      stephenw10 Netgate Administrator
      last edited by

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

      What pfSense version is that?

      D 1 Reply Last reply Reply Quote 0
      • D
        DavcoreTech @stephenw10
        last edited by

        @stephenw10 this is the version.

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

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

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

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

            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 Reply Quote 0
            • L
              Luca De Andreis @stephenw10
              last edited by Luca De Andreis

              @stephenw10

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

              Applied in changeset 64075a4359d070c300e09a94c2cf1f4854ce649b

              D 1 Reply Last reply Reply Quote 1
              • D
                DavcoreTech @stephenw10
                last edited by

                @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

                  @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 Reply Quote 0
                  • L
                    Luca De Andreis @DavcoreTech
                    last edited by

                    @DavcoreTech
                    Apply patch 64075a4359d070c300e09a94c2cf1f4854ce649b solves the problem.

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

                      @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
                      • GertjanG
                        Gertjan @DavcoreTech
                        last edited by

                        @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 Reply Quote 0
                        • D
                          DavcoreTech @Gertjan
                          last edited by

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

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

                            @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 Reply Quote 1
                            • D
                              DavcoreTech @Gertjan
                              last edited by

                              @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

                                @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

                                GertjanG 1 Reply Last reply Reply Quote 0
                                • GertjanG
                                  Gertjan @Luca De Andreis
                                  last edited by

                                  @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.