PHP Fatal error: Uncaught TypeError in /etc/inc/captiveportal.inc
-
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/FreeBSCrash 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 -
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
-
@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.. ?
-
@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.
-
@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 :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 ......