Bug #14364
openAPCUPSD unable to process date string
0%
Description
Hi,
After upgrading on a new install from 2.6.0 to + v23.01 (on amd64 if relevant) I'm unable to use the apcupsd widget on the homepage because it can't parse the battery replacement date.
I get a crash report (attached) and the following text from the widget on the home page:
Fatal error: Uncaught Exception: Failed to parse time string (20/04/23) at position 0 (2): Unexpected character in /usr/local/www/widgets/widgets/apcupsd.widget.php:255 Stack trace: #0 /usr/local/www/widgets/widgets/apcupsd.widget.php(255): DateTime->__construct('20/04/23') #1 /usr/local/www/widgets/widgets/apcupsd.widget.php(341): compose_apc_contents('apcupsd-0') #2 {main} thrown in /usr/local/www/widgets/widgets/apcupsd.widget.php on line 255 PHP ERROR: Type: 1, File: /usr/local/www/widgets/widgets/apcupsd.widget.php, Line: 255, Message: Uncaught Exception: Failed to parse time string (20/04/23) at position 0 (2): Unexpected character in /usr/local/www/widgets/widgets/apcupsd.widget.php:255 Stack trace: #0 /usr/local/www/widgets/widgets/apcupsd.widget.php(255): DateTime->__construct('20/04/23') #1 /usr/local/www/widgets/widgets/apcupsd.widget.php(341): compose_apc_contents('apcupsd-0') #2 {main} thrown
Seems similar to #13970 to me however not the same and that bug is marked as "done" a few months ago.
Thanks!
Files
Updated by Kris Phillips over 1 year ago
- Status changed from New to Incomplete
Tested with an APC UPS on 23.05 with the latest apcupsd package. Unable to reproduce this error. Can you please provide some screenshots and reproduction steps? I'm not seeing any issues here.
Updated by Lloyd Collins over 1 year ago
- File apcupsd screenshot 1.png apcupsd screenshot 1.png added
Kris Phillips wrote in #note-1:
Tested with an APC UPS on 23.05 with the latest apcupsd package. Unable to reproduce this error. Can you please provide some screenshots and reproduction steps? I'm not seeing any issues here.
Sure, screenshot of the error on the firewall attached.
Reproduction steps:
1. APC SU420INET connected via serial to 23.05-RELEASE on hardware Lenovo M720Q "tiny" PC.
2. APCUPSD at version 0.3.92_1 installed from standard pfsense repos
3. Configure the battery renewal date and other EEPROM settings using the APC "smart protocol" over the serial link via pfsense command line and "apctest" command
4. Add APCUPSD widget to PFSense dashboard
5. Get error in screenshot.
Updated by Jordan G over 1 year ago
Are you able to try with the month and then day in the first and second numbers respectively when entering the date? I think it's expecting the date format as pictured, I'm trying to recreate but I'm not having any success rewriting my eeprom with the date formatted day first via apctest.
Updated by Lloyd Collins over 1 year ago
Done, and it's fixed the problem and the widget is working again, but apctest expects the format in DD/MM/YY and the widget should IMO cater for this as it's the default format for almost any country which isn't the USA.
Updated by Kris Phillips over 1 year ago
- Status changed from Incomplete to Confirmed
Yeah we should add a date format option to the widget so that it properly displayed depending on user input.
Updated by Jordan G about 1 year ago
Not sure where the date format is being pulled from, I'm using an older bn700 APC UPS and my date format is mm/dd/yyyy as depicted when using apctest