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 12 months 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 #1

Updated by Buster de about 1 year ago

By reading /usr/local/pkg/pfblockerng/pfblockerng.inc it seems a few more lines down this part might be affected as well:

    // Collect static DHCPv6 hostnames/IPs
    foreach (config_get_path('dhcpdv6', []) as $dhcpv6) {
        if (isset($dhcpv6['staticmap']) && is_array($dhcpv6['staticmap'])) {
Actions #2

Updated by Danilo Zrenjanin about 1 year ago

I set up DHCP Static Mappings in the DHCP server but couldn't replicate the issue with a fresh pfBlocker installation configuring it using the Wizard.

23.05.1-RELEASE (amd64)
built on Wed Jun 28 03:57:27 UTC 2023
FreeBSD 14.0-CURRENT
pfBlockerNG-devel 3.2.0_5

Perhaps there is a specific setting in the DNS resolver to trigger this PHP error?

Actions #3

Updated by Alex Kolesnik about 1 year ago

I do have some customizations in unbound, but they're not connected with dhcp (private-domain, local-zone, forward-zone and cache definitions). Also I didn't change them for a long time.

Actions #4

Updated by Lleir Esteves about 1 year ago

Alex Kolesnik wrote:

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

[...]

Workaround:
[...]

The Workaround works like a champ, I've been with this problem 2 weeks finding a solution, and I'm in the version 2.7.0 -> pfblockerng-devel-3.2.0_6 and I still need to do the workaround.

Actions #6

Updated by Marcos M 12 months ago

  • Status changed from New to Duplicate
Actions #7

Updated by Marcos M 12 months ago

  • Has duplicate Bug #14230: PHP error with pfBlockerNG added
Actions

Also available in: Atom PDF