Project

General

Profile

Actions

Bug #14230

open

PHP error with pfBlockerNG

Added by Marcos M about 1 year ago. Updated 7 months ago.

Status:
New
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:
23.01
Affected Architecture:
All

Description

On pfBlockerNG-3.2.0_3 and pfSense-23.01.

[02-Apr-2023 00:38:16 America/Chicago] PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in /usr/local/pkg/pfblockerng/pfblockerng.inc:5309
Stack trace:
#0 /usr/local/pkg/pfblockerng/pfblockerng.inc(5533): pfb_collect_localhosts()
#1 /usr/local/pkg/pfblockerng/pfblockerng.inc(1030): pfb_daemon_filterlog()
#2 {main}
  thrown in /usr/local/pkg/pfblockerng/pfblockerng.inc on line 5309

Relevant config attached.


Files

config_pfb.xml (36.2 KB) config_pfb.xml Marcos M, 04/02/2023 03:10 PM

Related issues

Is duplicate of Bug #14554: PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on stringDuplicate

Actions
Actions #1

Updated by Marcos M about 1 year ago

As a workaround, use the System Patches package to apply the following patch (set Path Strip Count to 0).

--- /usr/local/pkg/pfblockerng/pfblockerng.inc
+++ /usr/local/pkg/pfblockerng/pfblockerng.inc
@@ -5307,7 +5307,7 @@ function pfb_collect_localhosts() {

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

     // Collect static DHCPv6 hostnames/IPs
     foreach (config_get_path('dhcpdv6', []) as $dhcpv6) {
-        if (is_array($dhcpv6['staticmap'])) {
+        if (is_array($dhcpv6) && is_array($dhcpv6['staticmap'])) {
             foreach ($dhcpv6['staticmap'] as $smap) {
                 $local_hosts[$smap['ipaddrv6']] = strtolower("{$smap['hostname']}");
             }


https://docs.netgate.com/pfsense/en/latest/development/system-patches.html

Actions #2

Updated by Kris Phillips about 1 year ago

I'm not seeing any PHP errors in 3.2.0_4 of pfBlockerNG. Was there any particular steps to reproduce this problem?

Actions #3

Updated by Andre Brait 7 months ago

Kris Phillips wrote in #note-2:

I'm not seeing any PHP errors in 3.2.0_4 of pfBlockerNG. Was there any particular steps to reproduce this problem?

I think it only happens when upgrading pfSense from the 2.6.0 line (and corresponding Plus) to 2.7.0 (and corresponding Plus).

Actions #5

Updated by Marcos M 7 months ago

  • Is duplicate of Bug #14554: PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string added
Actions

Also available in: Atom PDF