jaredhendrickson13 / pfsense-api

The missing REST API package for pfSense
https://pfrest.org/
Apache License 2.0
672 stars 101 forks source link

PHP variable redeclaration error when accessing Status>Monitoring graphs after installing pfsense-api v2 #522

Closed kosmonot closed 1 month ago

kosmonot commented 1 month ago

Describe the bug After installing pfSfsense api v2 (I had been running v1 ) I started having an issue with the whitescreen php error below every time I attempted to go to Status>Monitoring. pfSsense itself does not crash however and still seems to function normally otherwise after this error. When I uninstall pfsense-api the error does not happen.

Crash report begins.  Anonymous machine information:

amd64
14.0-CURRENT
FreeBSD 14.0-CURRENT amd64 1400094 #1 RELENG_2_7_2-n255948-8d2b56da39c: Wed Dec  6 20:45:47 UTC 2023     root@freebsd:/var/jenkins/workspace/pfSense-CE-snapshots-2_7_2-main/obj/amd64/StdASW5b/var/jenkins/workspace/pfSense-CE-snapshots-2_7_2-main/sources/F

Crash report details:

PHP Errors:
[25-Jul-2024 18:28:09 US/Eastern] PHP Fatal error:  Cannot redeclare ceil2() (previously declared in /etc/inc/shaper.inc:37) in /etc/inc/shaper.inc on line 37

No FreeBSD crash data found.

To Reproduce Steps to reproduce the behavior: Install pfsense-api v2 on 2.7.2 Go to Status>Monitoring. See whitescreen PHP error above. Return to pfSense dashboard ok.

Expected behavior Go to Status>Monitoring and see graphs.

Screenshots or Response N/A

pfSense Version & Package Version:

Relevant info I have some traffic shaping limiter stuff configured for mitigating buffer bloat on a Mullvad wireguard VPN gateway I use for browsing and I think it may be related to this. Please note I am not confident my shaper/limiter configurations are implemented properly with best practices. I had questions about applying limiters to a vpn gateway withing the WAN gateway and just experimented to see what worked. The limiter config does eliminate the triple-digit latency I was experiencing on uploads using this VPN gateway though. I tried deleting the limiters and rebooting but I still got the PHP redeclaration error when I went to Status>Monitoring. I also did a fresh install of 2.72 and restored my config file.

jaredhendrickson13 commented 1 month ago

I can reproduce this but it looks like the direct cause is pfSense's code itself. It is using the collision prone require call for shaper.inc on this page instead of require_once. I should be able to work around this though. I have a patch going out before the end of the week so I should be able to get this in as well.

Thanks!

kosmonot commented 1 month ago

That's really awesome!

On Thu, Jul 25, 2024, 7:40 PM Jared Hendrickson @.***> wrote:

I can reproduce this but it looks like the direct cause is pfSense's code itself. It is using the collision prone require call for shaper.inc on this page https://github.com/pfsense/FreeBSD-ports/blob/c94aad1f5edc5dd0a6842a76113d2e686a56f75d/sysutils/pfSense-Status_Monitoring/files/usr/local/www/status_monitoring.php#L28-L30 instead of require_once. I should be able to work around this though. I have a patch going out before the end of the week so I should be able to get this in as well.

Thanks!

— Reply to this email directly, view it on GitHub https://github.com/jaredhendrickson13/pfsense-api/issues/522#issuecomment-2251575547, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBPR3VDK7KUDG7ZK7PDUCLZOGEFFAVCNFSM6AAAAABLPOUOESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJRGU3TKNJUG4 . You are receiving this because you authored the thread.Message ID: @.***>

kosmonot commented 1 month ago

All good here now, thank you!!!