Project

General

Profile

Bug #8993

PHP error from filter_rules_sort() when config.xml contains no rules

Added by Jim Pingle 6 months ago. Updated 4 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Rules/NAT
Target version:
Start date:
10/02/2018
Due date:
% Done:

100%

Estimated time:
Affected Version:
2.4.4
Affected Architecture:
All

Description

[01-Oct-2018 10:42:56 Etc/UTC] PHP Fatal error: Uncaught Error: Only variables can be passed by reference in /etc/inc/pfsense-utils.inc:2805
Stack trace:
#0 /usr/local/www/firewall_rules_edit.php(146): filter_rules_sort()
#1 {main}
thrown in /etc/inc/pfsense-utils.inc on line 2805

If someone removes all rules, leaving only automatic rules like the anti-lockout rule and bogons, this error can occur.

Associated revisions

Revision 67807c95 (diff)
Added by Jim Pingle 6 months ago

Prevent a reference error w/o rules in the config. Fixes #8993

Revision ddfda1d6 (diff)
Added by Jim Pingle 6 months ago

Prevent a reference error w/o rules in the config. Fixes #8993

(cherry picked from commit 67807c9536ae1810a067155049c96e8d2b634777)

History

#1 Updated by Jim Pingle 6 months ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100

#2 Updated by Steve Beaver 6 months ago

  • Target version changed from 2.4.4-GS to 2.4.4_1

#3 Updated by Steve Beaver 6 months ago

  • Target version changed from 2.4.4_1 to 2.4.4-GS

#4 Updated by Luiz Souza 4 months ago

  • Target version changed from 2.4.4-GS to 2.4.4_1

#5 Updated by Danilo Zrenjanin 4 months ago

I couldn't replicate this one on:

SG-3100
2.4.4-RELEASE (arm)
built on Thu Sep 20 09:33:19 EDT 2018
FreeBSD 11.2-RELEASE-p3

I tried with a different type of rules with and without aliases. If there is a specific way how to replicate it, please provide more details.

#6 Updated by Jim Pingle 4 months ago

You have to delete all of the rules in the config so it only has <filter></filter>

So you'd have to hit it from LAN with the anti-lockout rule passing you through.

#7 Updated by Paighton Bisconer 4 months ago

  • Status changed from Feedback to Resolved

Was able to replicate this after verifying <filter></filter> in config, connecting on the Anti-lockout rule, and trying to add a new firewall rule on LAN I received this error when the GUI failed:

Fatal error: Uncaught Error: Only variables can be passed by reference in /etc/inc/pfsense-utils.inc:2864 Stack trace: #0 /usr/local/www/firewall_rules_edit.php(146): filter_rules_sort() #1 {main} thrown in /etc/inc/pfsense-utils.inc on line 2864 PHP ERROR: Type: 1, File: /etc/inc/pfsense-utils.inc, Line: 2864, Message: Uncaught Error: Only variables can be passed by reference in /etc/inc/pfsense-utils.inc:2864 Stack trace: #0 /usr/local/www/firewall_rules_edit.php(146): filter_rules_sort() #1 {main} thrown

After hitting the Back button in the browser I had an alert:

Notices
PHP errors
PHP ERROR: Type: 1, File: /etc/inc/pfsense-utils.inc, Line: 2864, Message: Uncaught Error: Only variables can be passed by reference in /etc/inc/pfsense-utils.inc:2864
Stack trace:
#0 /usr/local/www/firewall_rules_edit.php(146): filter_rules_sort()
#1 {main}
thrown    @ 2018-11-22 01:08:48

Crash report:

Crash report begins.  Anonymous machine information:

arm
11.2-RELEASE-p3
FreeBSD 11.2-RELEASE-p3 #11 220591260a0(factory-RELENG_2_4_4): Thu Sep 20 10:39:07 EDT 2018     root@buildbot3:/crossbuild/244/obj/armv6/zusWWsAv/arm.armv6/crossbuild/244/pfSense/tmp/FreeBSD-src/sys/pfSense-uFW

Crash report details:

PHP Errors:
[22-Nov-2018 01:08:48 Etc/UTC] PHP Fatal error:  Uncaught Error: Only variables can be passed by reference in /etc/inc/pfsense-utils.inc:2864
Stack trace:
#0 /usr/local/www/firewall_rules_edit.php(146): filter_rules_sort()
#1 {main}
  thrown in /etc/inc/pfsense-utils.inc on line 2864

No FreeBSD crash data found.

Upgraded to Current Base System 2.4.5.a.20181120.0855, retested with same steps, was able to add new firewall rule without issue.

Confirmed resolved.

#8 Updated by Joachim Tingvold 4 months ago

Any way to fix this manually? (i.e. if I don't want to update to dev)

#9 Updated by Jim Pingle 4 months ago

Apply the commit listed above using the System Patches package: https://www.netgate.com/docs/pfsense/development/system-patches.html

#10 Updated by Joachim Tingvold 4 months ago

Ah, cool! Thanks!

Also available in: Atom PDF