PHP error APCUPSD widget
-
Installed apcupsd onto 23.01rc latest 23.01.r.20230208.1414
ups status is fine:
Running: apcaccess -h 0.0.0.0:3551APC : 001,036,0866
DATE : 2023-02-09 16:34:39 -0500
HOSTNAME : pfSense.home.arpa
VERSION : 3.14.14 (31 May 2016) freebsd
UPSNAME : SparkyHowever the dashboard widget works fine after installation but then throws an error after an onbatt and online cycle when disconnecting ups from power source:
PHP Fatal error: Uncaught TypeError: strrpos(): Argument #2 ($needle) must be of type string, array given in /usr/local/www/widgets/widgets/apcupsd.widget.php:130
Stack trace:
#0 /usr/local/www/widgets/widgets/apcupsd.widget.php(130): strrpos('ONLINE ', Array)
#1 /usr/local/www/widgets/widgets/apcupsd.widget.php(339): compose_apc_contents('apcupsd-0')
#2 {main}
thrown in /usr/local/www/widgets/widgets/apcupsd.widget.php on line 130Line 130 in /usr/local/www/widgets/widgets/apcupsd.widget.php:
if (($bchrg != null) && (in_array("ONLINE", $statusarray)) && ($bchrg < 100) && (strrpos($statstr, $mainstatarray) === false)) {
Thanks for any input!
-
Found an unresolved bug:
https://redmine.pfsense.org/issues/11898 -
@micma_ said in PHP error APCUPSD widget:
https://redmine.pfsense.org/issues/11898
You should update that bug with your new data since it looks exactly the same even in the new PHP version.
Steve
-
Don't know what to think of it. This morning the widget is running fine!
-
Yeah it's not the usual PHP errors we might expect from the version change. There's clearly something variable in play. You should probably note your config for apcupsd and add it to the bug.
Steve
-
@micma_ said in PHP error APCUPSD widget:
https://redmine.pfsense.org/issues/11898
Same here, apcupsd widget crashed after update to 23.01
-
Exactly the same error? Is it repeatable? Update the bug report with your findings if so.
-
Not saying I know this is related, however I noticed the OP is running on the "default" setting stating
Running: apcaccess -h 0.0.0.0:3551where as I am running on the more "focused" setting of
Running: apcaccess -h 127.0.0.1:3551per the setting / description here:
No issue here that I have noticed. But it is also possible this unit hasn't had a transfer to battery in the past couple of days. There has been a system reboot (normal reboot cycle via the diag menu).
JR
-
I upgraded a few days ago and all was fine.
However today as it's very windy, we have been having power fluctuations which has started sending me APC alert email after email... I can't get them to stop without disabling APC.I tried unplugging and replugging the USB connection but that did not do anything.
PHP ERROR: Type: 1, File: /usr/local/www/widgets/widgets/apcupsd.widget.php, Line: 130, Message: Uncaught TypeError: strrpos(): Argument #2 ($needle) must be of type string, array given in /usr/local/www/widgets/widgets/apcupsd.widget.php:130
Stack trace:
#0 /usr/local/www/widgets/widgets/apcupsd.widget.php(130): strrpos('ONLINE ', Array)
#1 /usr/local/www/widgets/widgets/apcupsd.widget.php(339): compose_apc_contents('apcupsd-0')
#2 {main}
thrown @ 2023-02-21 16:43:28Error logging - shows
PHP errors
PHP ERROR: Type: 1, File: /usr/local/www/widgets/widgets/apcupsd.widget.php, Line: 130, Message: Uncaught TypeError: strrpos(): Argument #2 ($needle) must be of type string, array given in /usr/local/www/widgets/widgets/apcupsd.widget.php:130
Stack trace:
#0 /usr/local/www/widgets/widgets/apcupsd.widget.php(130): strrpos('ONLINE ', Array)
#1 /usr/local/www/widgets/widgets/apcupsd.widget.php(339): compose_apc_contents('apcupsd-0')
#2 {main}
thrown @ 2023-02-21 16:54:05
PHP ERROR: Type: 1, File: /usr/local/www/widgets/widgets/apcupsd.widget.php, Line: 130, Message: Uncaught TypeError: strrpos(): Argument #2 ($needle) must be of type string, array given in /usr/local/www/widgets/widgets/apcupsd.widget.php:130
Stack trace:
#0 /usr/local/www/widgets/widgets/apcupsd.widget.php(130): strrpos('ONLINE ', Array)
#1 /usr/local/www/widgets/widgets/apcupsd.widget.php(339): compose_apc_contents('apcupsd-0')
#2 {main}
thrown @ 2023-02-21 16:54:15And now the power is out...
-
That's the open bug referenced above:
https://redmine.pfsense.org/issues/11898