Cacti / plugin_weathermap

Weathermap for Cacti 1.x
MIT License
77 stars 26 forks source link

PHP error #146

Closed jdimea closed 2 months ago

jdimea commented 2 months ago

Getting the following error when running PHP 8.3 with the latest development version 2024/04/23 16:20:30 - ERROR PHP PARSE in Plugin 'weathermap': syntax error, unexpected '?', expecting '&' or variable (T_VARIABLE) in file: /home/cacti/public_html/plugins/weathermap/lib/WeatherMap.class.php on line: 1861 2024/04/23 16:20:30 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'weathermap'

jdimea commented 2 months ago

This doesn't seem to be specific to PHP 8.3 . I am also seeing it on PHP 8.2 and PHP 8.1 and PHP 7.4

TheWitness commented 2 months ago

Can you update to the latest develop and check again?

jdimea commented 2 months ago

Still seems to be occurring with the latest develop:

2024/04/29 11:45:31 - ERROR PHP PARSE in  Plugin 'weathermap': syntax error, unexpected '?', expecting '&' or variable (T_VARIABLE) in file: /home/cacti/public_html/plugins/weathermap/lib/WeatherMap.class.php on line: 1863
2024/04/29 11:45:31 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'weathermap'
TheWitness commented 2 months ago

What PHP version? What happens when you run:

php -l lib/WeatherMap.class.php?

jdimea commented 2 months ago

PHP 8.3.6 currently. I had tried several other versions and had the same thing happen previously though.

# php -l lib/WeatherMap.class.php 
No syntax errors detected in lib/WeatherMap.class.php

The error seems to occur when the poller runs after enabling the plugin.

TheWitness commented 2 months ago

Do you have php-intl installed? Run

php -m

Post the result.

jdimea commented 2 months ago

Yeah I had previously checked and that was installed. Here is the list of modules

~]# php -m
[PHP Modules]
bz2
calendar
Core
crypto
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
gnupg
hash
iconv
imagick
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
random
readline
Reflection
session
shmop
SimpleXML
snmp
sockets
sodium
SPL
sqlite3
ssh2
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
yaml
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
jdimea commented 2 months ago

Actually, looking into this further it looks like the poller was being called with an older version/incompatible version of PHP instead of the one configured with Apache via the cron. I updated the cron to use the active PHP installation which looks to have addressed the issue.