Project

General

Profile

Actions

Bug #14554

closed

PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string

Added by Alex Kolesnik over 1 year ago. Updated about 1 year ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
pfBlockerNG
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Affected Version:
2.7.0
Affected Plus Version:
Affected Architecture:
All

Description

https://forum.netgate.com/topic/180950/error-on-pfblockerng-inc-5310-pfblockerng-devel-3-2-0_5

[20-Jun-2023 00:16:58 Europe/Paris] PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in /usr/local/pkg/pfblockerng/pfblockerng.inc:5310
Stack trace:
#0 /usr/local/pkg/pfblockerng/pfblockerng.inc(5534): pfb_collect_localhosts()
#1 /usr/local/pkg/pfblockerng/pfblockerng.inc(1031): pfb_daemon_filterlog()
#2 {main}
  thrown in /usr/local/pkg/pfblockerng/pfblockerng.inc on line 5310
[20-Jun-2023 12:16:41 Europe/Paris] PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in /usr/local/pkg/pfblockerng/pfblockerng.inc:5310
Stack trace:
#0 /usr/local/pkg/pfblockerng/pfblockerng.inc(5534): pfb_collect_localhosts()
#1 /usr/local/pkg/pfblockerng/pfblockerng.inc(1031): pfb_daemon_filterlog()
#2 {main}
  thrown in /usr/local/pkg/pfblockerng/pfblockerng.inc on line 5310

Workaround:

--- /usr/local/pkg/pfblockerng/pfblockerng.inc.orig     2023-07-06 11:33:35.239744000 +0300
+++ /usr/local/pkg/pfblockerng/pfblockerng.inc  2023-07-06 10:45:05.421579000 +0300
@@ -5307,7 +5307,7 @@

        // Collect static DHCP hostnames/IPs
        foreach (config_get_path('dhcpd', []) as $dhcp) {
-               if (is_array($dhcp['staticmap'])) {
+               if (isset($dhcp['staticmap']) && is_array($dhcp['staticmap'])) {
                        foreach ($dhcp['staticmap'] as $smap) {
                                $local_hosts[$smap['ipaddr']] = strtolower("{$smap['hostname']}");
                        }


Related issues

Has duplicate Bug #14230: PHP error with pfBlockerNGNew

Actions
Actions

Also available in: Atom PDF