-
-
Notifications
You must be signed in to change notification settings - Fork 436
Improve PHP 8.1 support for Installer #5662
Description
Describe the bug
In php8, a number of notices have been converted into warnings(https://www.php.net/manual/en/migration80.incompatible.php):
- Attempting to read an undefined array key.
When I tried to install cacti(both cacti-1.2.26 and develop) in php8, I met the following errors.
...
Warning: Undefined array key "name" in /usr/local/src/cacti-develop/lib/installer.php on line 1301
Warning: Undefined array key "name" in /usr/local/src/cacti-develop/lib/installer.php on line 1302
Warning: Undefined array key "name" in /usr/local/src/cacti-develop/lib/installer.php on line 1303
Warning: Undefined array key "name" in /usr/local/src/cacti-develop/lib/installer.php on line 1311
Warning: Undefined array key "name" in /usr/local/src/cacti-develop/lib/installer.php on line 1301
Warning: Undefined array key "name" in /usr/local/src/cacti-develop/lib/installer.php on line 1302
...
When I debugged this, I found that it appears when some PHP modules are not installed such as simplexml and zlib.
https://github.com/Cacti/cacti/blob/develop/install/functions.php#L620
https://github.com/Cacti/cacti/blob/develop/lib/installer.php#L1301
Here are the contents of the array in issue(in my debugging logs).
...
2024-02-06 14:41:55 - INSTALL-TEMPLATES: always: known array: Array ( [filename] => ACME.xml.gz )
405 2024-02-06 14:41:55 - INSTALL-TEMPLATES: always: known array: Array ( [filename] => ACME.xml.gz [name] => ACME.xml.gz )
406 2024-02-06 14:41:55 - INSTALL-TEMPLATES: always: known array: Array ( [filename] => AKCP_Device.xml.gz )
407 2024-02-06 14:41:55 - INSTALL-TEMPLATES: always: known array: Array ( [filename] => AKCP_Device.xml.gz [na me] => AKCP_Device.xml.gz )
408 2024-02-06 14:41:55 - INSTALL-TEMPLATES: always: known array: Array ( [filename] => APC_InfraStruXure_InRo w_CRAC.xml.gz )
409 2024-02-06 14:41:55 - INSTALL-TEMPLATES: always: known array: Array ( [filename] => APC_InfraStruXure_InRo w_CRAC.xml.gz [name] => APC_InfraStruXure_InRow_CRAC.xml.gz )
...
The arrays are overlapping, and one of the overlapping arrays does not have a name key.
From the php8 version below, instructions for not installing are clearly displayed during the installation process.
To Reproduce
Steps to reproduce the behavior:
Install PHP8 excluding PHP's zlib module.
And install any cacti versions.
Expected behavior
Instructions for not installing should be displayed during the installation process.
Screenshots
Additional context
Add any other context about the problem here.