Regression #13660
closedFeature #13446: Upgrade PHP from 7.4 to 8.1
PHP8.1 error after applying floating rules changes
100%
Description
Tested on 23.01.a.20221114.0600
After applying floating rules changes, the following error showed under the rules table:
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/firewall_rules.php:54 Stack trace: #0 /usr/local/www/firewall_rules.php(85): get_pf_rules(Array, 1627764969, 1627764969) #1 /usr/local/www/firewall_rules.php(769): print_states(1627764969) #2 {main} thrown in /usr/local/www/firewall_rules.php on line 54 PHP ERROR: Type: 1, File: /usr/local/www/firewall_rules.php, Line: 54, Message: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/firewall_rules.php:54 Stack trace: #0 /usr/local/www/firewall_rules.php(85): get_pf_rules(Array, 1627764969, 1627764969) #1 /usr/local/www/firewall_rules.php(769): print_states(1627764969) #2 {main} thrown
Reloading the page then showed the rules correctly and the following alert/crash report was shown:
PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/firewall_rules.php:54 Stack trace: #0 /usr/local/www/firewall_rules.php(85): get_pf_rules(Array, 1627764969, 1627764969) #1 /usr/local/www/firewall_rules.php(769): print_states(1627764969) #2 {main} thrown in /usr/local/www/firewall_rules.php on line 54
Related issues
Updated by Jim Pingle about 2 years ago
- Target version set to 2.7.0
- Parent task set to #13446
- Plus Target Version set to 23.01
- Release Notes changed from Default to Force Exclusion
Updated by Marcos M about 2 years ago
I managed to trigger this a couple more times while changing limiter settings and simply browsing to the floating rules page - can't reproduce it consistently though.
Updated by Jim Pingle about 2 years ago
- Has duplicate Bug #13721: PHP Fatal error - firewall_rules.php - FreeBSD 14.0-CURRENT #0 devel-main-n255818-a851396c4f4: Fri Dec 2 06:29:25 UTC 2022 added
Updated by Reid Linnemann about 2 years ago
- Assignee set to Reid Linnemann
This is probably another case where the returned array can contain an element keyed 'error' that indicates some error encountered e.g. when calling the ioctl. This is a caveat of how the return value is used to return both values and error messages in some of the module funcs. I'll have a look and patch this up.
Updated by Reid Linnemann about 2 years ago
- Status changed from New to Feedback
- % Done changed from 0 to 100
Applied in changeset 483512b3a3226132b7b249f7ea3e2146d3829c23.
Updated by Jim Pingle about 2 years ago
- Status changed from Feedback to Resolved
I loaded/edited/saved/applied a bunch of floating rules without error on the latest snapshot. Hard to say if it's solved 100% since it wasn't easy to consistently reproduce before, but it appears to be OK now.
If someone else hits it again we can reopen and revisit.