Skip to content

Add support for PHP 8 #4475

@paulgevers

Description

@paulgevers

Describe the bug

Debian is in the process of moving to PHP8.1 (it's currently available in experimental). The test suite of Cacti in Debian is failing because a lot of warning show up in the log.

To Reproduce

Steps to reproduce the behavior:

  1. Replace your php instance with php8.1. E.g. in a Debian unstable environment, install the following packages from experimental: php-cli, php-gd, php-json, php-gmp, php-ldap, php-mbstring, php-mysql, php-phpmyadmin-motranslator, php-phpseclib, php-snmp, php-twig, php-xml,

  2. Run tests/tools/check_all_pages.sh and tests/tools/check_cli_version.sh

  3. See how they fail

  4. See error (at the bottom)

Desktop (please complete the following information)

  • OS: Debian

  • Browser wget

  • Version 1.21.2

Errors

Original log: https://ci.debian.net/data/autopkgtest/unstable/amd64/c/cacti/16973612/log.gz

Filtered, sorted and unique:

CMDPHP PHP ERROR Backtrace:  (/automation_networks.php[52]:network_edit(), /automation_networks.php[478]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/automation_networks.php[58]:networks(), /automation_networks.php[1145]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/automation_networks.php[58]:networks(), /automation_networks.php[1148]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/automation_networks.php[58]:networks(), /automation_networks.php[1149]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (CactiShutdownHandler())
CMDPHP PHP ERROR Backtrace:  (/cdef.php[95]:cdef(), /cdef.php[912]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/cdef.php[95]:cdef(), /cdef.php[913]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/color.php[69]:color(), /color.php[729]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/color.php[69]:color(), /color.php[730]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/color_templates.php[53]:aggregate_color_template(), /color_templates.php[660]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/color_templates.php[53]:aggregate_color_template(), /color_templates.php[661]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/data_input.php[74]:data(), /data_input.php[976]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/data_input.php[74]:data(), /data_input.php[977]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/data_queries.php[100]:data_query_edit(), /data_queries.php[1155]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/data_queries.php[107]:data_query(), /data_queries.php[1436]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/data_queries.php[107]:data_query(), /data_queries.php[1437]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/data_source_profiles.php[99]:profile(), /data_source_profiles.php[1088]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/data_source_profiles.php[99]:profile(), /data_source_profiles.php[1092]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/data_source_profiles.php[99]:profile(), /data_source_profiles.php[1094]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/data_templates.php[74]:template(), /data_templates.php[1153]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/gprint_presets.php[53]:gprint_presets(), /gprint_presets.php[438]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/gprint_presets.php[53]:gprint_presets(), /gprint_presets.php[439]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/graph_templates.php[77]:template(), /graph_templates.php[855]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/host_templates.php[92]:template(), /host_templates.php[876]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/pollers.php[261]:pollers(), /pollers.php[1027]:round(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/pollers.php[261]:pollers(), /pollers.php[1043]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/pollers.php[261]:pollers(), /pollers.php[1044]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/pollers.php[261]:pollers(), /pollers.php[1045]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/pollers.php[261]:pollers(), /pollers.php[1046]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/sites.php[215]:sites(), /sites.php[587]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/user_admin.php[72]:user(), /user_admin.php[2349]:CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/utilities.php[80]:utilities_view_tech(), /utilities.php[316]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/utilities.php[80]:utilities_view_tech(), /utilities.php[321]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/utilities.php[80]:utilities_view_tech(), /utilities.php[573]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/utilities.php[80]:utilities_view_tech(), /utilities.php[594]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/utilities.php[80]:utilities_view_tech(), /utilities.php[647]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/utilities.php[80]:utilities_view_tech(), /utilities.php[648]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/utilities.php[80]:utilities_view_tech(), /utilities.php[649]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/utilities.php[80]:utilities_view_tech(), /utilities.php[650]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/vdef.php[87]:vdef(), /vdef.php[906]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
CMDPHP PHP ERROR Backtrace:  (/vdef.php[87]:vdef(), /vdef.php[907]:number_format_i18n(), /include/global_languages.php[717]:number_format(), CactiErrorHandler())
  done.
ERROR PHP DEPRECATED: Function strftime() is deprecated in file: /usr/share/cacti/site/user_admin.php  on line: 2349
ERROR PHP DEPRECATED: number_format(): Passing null to parameter #1 ($num) of type float is deprecated in file: /usr/share/cacti/site/include/global_languages.php  on line: 717
ERROR PHP DEPRECATED: number_format(): Passing null to parameter #2 ($decimals) of type int is deprecated in file: /usr/share/cacti/site/include/global_languages.php  on line: 717
ERROR PHP DEPRECATED: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in file: /usr/share/cacti/site/pollers.php  on line: 1027
ERROR PHP ERROR: Uncaught DivisionByZeroError: Division by zero in /usr/share/cacti/site/utilities.php:2229 Stack trace: #0 /usr/share/cacti/site/utilities.php(84): boost_display_run_status() #1 {main} thrown in file: /usr/share/cacti/site/utilities.php on line: 2229
ERROR PHP WARNING: fopen(/usr/share/cacti/site/include/vendor/csrf/csrf-secret.php): Failed to open stream: Permission denied in file: /usr/share/cacti/site/include/vendor/csrf/csrf-magic.php  on line: 490
PHP Deprecated:  str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /usr/share/cacti/site/include/global_languages.php on line 334
PHP Deprecated:  substr(): Passing null to parameter #1 ($string) of type string is deprecated in /usr/share/cacti/site/include/global_languages.php on line 338
PHP Warning:  Trying to access array offset on value of type null in /usr/share/cacti/site/lib/functions.php on line 5410

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUndesired behaviourresolvedA fixed issue

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions