Project

General

Profile

Actions

Bug #13619

closed

pfSense - Feature #13446: Upgrade PHP from 7.4 to 8.1

PHP Error in pfblockerNG-devel widget

Added by Brad Davis over 1 year ago. Updated 10 months ago.

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

100%

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

Description

pfSense-pkg-pfBlockerNG-devel-3.1.0_10

Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/widgets/widgets/pfblockerng.widget.php:303 Stack trace: #0 /usr/local/www/widgets/widgets/pfblockerng.widget.php(472): pfBlockerNG_update_table() #1 /usr/local/www/widgets/widgets/pfblockerng.widget.php(948): pfBlockerNG_get_header() #2 /usr/local/www/index.php(430): include('/usr/local/www/...') #3 {main} thrown in /usr/local/www/widgets/widgets/pfblockerng.widget.php on line 303 PHP ERROR: Type: 1, File: /usr/local/www/widgets/widgets/pfblockerng.widget.php, Line: 303, Message: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/widgets/widgets/pfblockerng.widget.php:303 Stack trace: #0 /usr/local/www/widgets/widgets/pfblockerng.widget.php(472): pfBlockerNG_update_table() #1 /usr/local/www/widgets/widgets/pfblockerng.widget.php(948): pfBlockerNG_get_header() #2 /usr/local/www/index.php(430): include('/usr/local/www/...') #3 {main} thrown

Files

clipboard-202211271021-lhh79.png (49.3 KB) clipboard-202211271021-lhh79.png aleksei prokofiev, 11/27/2022 01:21 AM
Actions #1

Updated by Jim Pingle over 1 year ago

  • Project changed from pfSense to pfSense Packages
  • Subject changed from Error in pfblockerNG-devel widget to PHP Error in pfblockerNG-devel widget
  • Category changed from Package System to pfBlockerNG
  • Release Notes deleted (Default)
Actions #2

Updated by BBcan177 . over 1 year ago

Its calling:

foreach (pfSense_get_pf_rules() as $prule) {
    $prule_id = $prule['tracker'];

Seems like some rules are missing the ['tracker'] key?

Can add a check to see if tracker exists before proceeding?

Actions #3

Updated by Marcos M over 1 year ago

Seems like some rules are missing the ['tracker'] key?

If I remember correctly while working on #13156, that is indeed the case. I did not write this with PHP8.1 in mind. The whole widget code should probably be reviewed for PHP8.1 compatibility issues.

Actions #4

Updated by Reid Linnemann over 1 year ago

BBcan177 . wrote in #note-2:

Its calling:

[...]

Seems like some rules are missing the ['tracker'] key?

Can add a check to see if tracker exists before proceeding?

No, this error is indicative of $prule being type string rather than array, which would hint that pfSense_get_pf_rules() is not doing what is expected by this script.

Actions #5

Updated by Jim Pingle over 1 year ago

  • Parent task set to #13446
Actions #6

Updated by Reid Linnemann over 1 year ago

  • Status changed from New to Feedback

This should be fixed as of 223d90f

Actions #7

Updated by Jordan G over 1 year ago

widget is able to be added to the dashboard now, running ver 23.01.a.20221118.0600

Actions #8

Updated by Alex Casanova over 1 year ago

With 23.01.a.20221118.0600 I these errors
Please find attached the logs:

Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/pkg/pfblockerng/pfblockerng_install.inc:109
Stack trace:
#0 /etc/inc/pkg-utils.inc(787) : eval()'d code(1): include_once()
#1 /etc/inc/pkg-utils.inc(787): eval()
#2 /etc/inc/pkg-utils.inc(905): eval_once('include_once('/...')
#3 /etc/rc.packages(76): install_package_xml('pfBlockerNG-dev...')
#4 {main}
  thrown in /usr/local/pkg/pfblockerng/pfblockerng_install.inc on line 109
PHP ERROR: Type: 1, File: /usr/local/pkg/pfblockerng/pfblockerng_install.inc, Line: 109, Message: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/pkg/pfblockerng/pfblockerng_install.inc:109
Stack trace:
#0 /etc/inc/pkg-utils.inc(787) : eval()'d code(1): include_once()
#1 /etc/inc/pkg-utils.inc(787): eval()
#2 /etc/inc/pkg-utils.inc(905): eval_once('include_once('/...')
#3 /etc/rc.packages(76): install_package_xml('pfBlockerNG-dev...')
#4 {main}
  thrownpkg-static: POST-INSTALL script failed
Actions #9

Updated by Marcos M over 1 year ago

  • Status changed from Feedback to New

There's a separate redmine for that one:
https://redmine.pfsense.org/issues/13679

Still seeing this on latest snap/pfB version within the widget window itself.

Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/widgets/widgets/pfblockerng.widget.php:303 Stack trace: #0 /usr/local/www/widgets/widgets/pfblockerng.widget.php(472): pfBlockerNG_update_table() #1 /usr/local/www/widgets/widgets/pfblockerng.widget.php(948): pfBlockerNG_get_header() #2 /usr/local/www/index.php(430): include('/usr/local/www/...') #3 {main} thrown in /usr/local/www/widgets/widgets/pfblockerng.widget.php on line 303 PHP ERROR: Type: 1, File: /usr/local/www/widgets/widgets/pfblockerng.widget.php, Line: 303, Message: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/widgets/widgets/pfblockerng.widget.php:303 Stack trace: #0 /usr/local/www/widgets/widgets/pfblockerng.widget.php(472): pfBlockerNG_update_table() #1 /usr/local/www/widgets/widgets/pfblockerng.widget.php(948): pfBlockerNG_get_header() #2 /usr/local/www/index.php(430): include('/usr/local/www/...') #3 {main} thrown

Note that this happened after upgrading. It prevented the navigation menu from being clicked. After manually going to a different page, clearing the alter, then going back to the dashboard, the widget loaded correctly.

Actions #10

Updated by Reid Linnemann over 1 year ago

The change was just merged to Plus this morning, try the next build please.

Actions #11

Updated by Reid Linnemann over 1 year ago

  • Status changed from New to Feedback
Actions #12

Updated by aleksei prokofiev over 1 year ago

Tested on 23.01.a.20221124.0600 and I don't see any errors on the widget

Actions #13

Updated by Marcos M over 1 year ago

  • Status changed from Feedback to Resolved

The package version was bumped (now today on 3.1.0_11) to include the fix for this issue on pfSense+. I'm no longer seeing the issue here after snapshot upgrades like I was seeing before.

Actions #14

Updated by Jim Pingle over 1 year ago

  • % Done changed from 0 to 100
Actions #15

Updated by Jim Pingle 10 months ago

  • Plus Target Version deleted (23.01)
Actions #16

Updated by Jim Pingle 10 months ago

  • Target version deleted (2.7.0)
Actions

Also available in: Atom PDF