captive portal
-
Hello
I am trying to set captive portal with php shell. but when I import it I get the following error.
pfsense version 2.7Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/sbin/pfSsh.php(374) : eval()'d code:16
Stack trace:
#0 /usr/local/sbin/pfSsh.php(374): eval()
#1 /usr/local/sbin/pfSsh.php(379): playback_text('global $config,...')
#2 /usr/local/sbin/pfSsh.php(232): playback_file('captiveportalco...')
#3 {main}
thrown in /usr/local/sbin/pfSsh.php(374) : eval()'d code on line 16
PHP ERROR: Type: 1, File: /usr/local/sbin/pfSsh.php(374) : eval()'d code, Line: 16, Message: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/sbin/pfSsh.php(374) : eval()'d code:16
Stack trace:
#0 /usr/local/sbin/pfSsh.php(374): eval()
#1 /usr/local/sbin/pfSsh.php(379): playback_text('global $config,...')
#2 /usr/local/sbin/pfSsh.php(232): playback_file('captiveportalco...')
#3 {main}php shell file
global $config;
$config = parse_config(true);$config["captiveportal"]["{H_ZONE_NAME}"] = [
"zone" => "h",
"descr" => "Hotspot Captive Portal",
"zoneid" => 3,
"interface" => "h",
"maxproc" => null,
"timeout" => null,
"idletimeout" => null,
"freelogins_count" => null,
"freelogins_resettimeout" => null,
"enable" => null,
"auth_method" => "radius",
"radacct_enable" => null,
"reauthenticateacct" => "stopstartfreeradius",
"httpsname" => null,
"preauthurl" => null,
"blockedmacsurl" => null,
"bwdefaultdn" => null,
"bwdefaultup" => null,
"certref" => $config["cert"][0]["refid"],
"radius_protocol" => "PAP",
"redirurl" => "ggggg",
"radiusip" => $config["interfaces"]["{H_LAN_INTERFACES}"]["ipaddr"],
"radiusip2" => null,
"radiusip3" => null,
"radiusip4" => null,
"radiusport" => "1812",
"radiusport2" => null,
"radiusport3" => null,
"radiusport4" => null,
"radiusacctport" => "1813",
"radiuskey" => "hotspot",
"radiuskey2" => null,
"radiuskey3" => null,
"radiuskey4" => null,
"radiusvendor" => "default",
"radiussrcip_attribute" => "wan",
"radmac_format" => "default",
"radiusnasid" => null,
"page" => null,
"auth_server" => "radius - LocalRadius",
"radacct_server" => "LocalRadius"];
write_config("Captive Portal "); -
-
Hi @warning31 retro bowl,
Did you find a way to fix this error? -
no
-
The playback file should now respect PHP 8.1 syntax.
Are you sure your playback file is compatible ?
I can't tell. For me, right now, "7.4" is good enough, I don't use the bleeding edge technology yet.It looks like that the eval complains about the very first line, "global $config;" but I'm not sure as it looks fine to me. eval is never clear about what it doesn't like.
And who knows : maybe "/usr/local/sbin/pfSsh.php" isn't 8.1 ready yet neither ....
-
pfSsh.php
is fine on PHP 8.1, the problem is in that code.You can't blindly access multi-level arrays without initializing them properly anymore in PHP.
https://docs.netgate.com/pfsense/en/latest/development/php-config-arrays.html