Regression #13970
closedPHP error in apcupsd widget from UTF-8 string handling
100%
Description
In 23.01 release:
PHP ERROR: Type: 1, File: /usr/local/www/widgets/widgets/apcupsd.widget.php, Line: 206, Message: Uncaught TypeError: ceil(): Argument #1 ($num) must be of type int|float, string given in /usr/local/www/widgets/widgets/apcupsd.widget.php:206 Stack trace: #0 /usr/local/www/widgets/widgets/apcupsd.widget.php(206): ceil('29.2\xC2') #1 /usr/local/www/widgets/widgets/apcupsd.widget.php(339): compose_apc_contents('apcupsd-0') #2 {main} thrown @ 2023-02-16 10:50:34
See: https://forum.netgate.com/topic/177946/apcupsd-widget-error-with-23-1-installed
Related issues
Updated by Jim Pingle almost 2 years ago
- Has duplicate Bug #14014: APCUPSD widget not working after pfSense + update to v.23.01 added
Updated by Jim Pingle almost 2 years ago
- Related to Bug #11898: PHP error from apcupsd dashboard widget when battery is charging added
Updated by Andrew Dakin almost 2 years ago
I'm seeing a similar issue. apcupsd is gathering data from the UPS. The widget is throwing this error after upgrading to 23.01.
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 15:44:34
Updated by Jim Pingle almost 2 years ago
- Subject changed from PHP error in apcupsd widget to PHP error in apcupsd widget from UTF-8 string handling
- Assignee set to Jim Pingle
This is from the degree symbol the package adds into the temperature string. At some point it changed and is now handled as UTF-8 so the usual string operators don't work on it properly.
Removing the symbol lets it work properly, and it's not really needed anyhow.
Updated by Jim Pingle almost 2 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Fix merged, will be in builds soon (might be a couple days)
Updated by Jordan G about 1 year ago
- Status changed from Resolved to Feedback
The widget has the following for the default entries in the warning/critical values by default, or possibly from a previous config restore. Clearing the value and saving seems to regenerate the string although it will accept entering numeric values within parameters. Also, the 'age levels' unit is not specified but it appears to be looking for number of days based on testing different values.
Project-Id-Version: PACKAGE VERSIONReport-Msgid-Bugs-To: MIME-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bitPO-Revision-Date: 2019-05-09 10:22+0000Last-Translator: Copied by Zanata <copied-by-zanata@zanata.org>Language-Team: English (United States)Language: en_USX-Generator: Zanata 4.6.2Plural-Forms: nplurals=2; plural=(n != 1)