Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-18919

Zabbix 4.0.28 graph cannot be displayed on PHP 5.4.16 environment

    XMLWordPrintable

Details

    • Problem report
    • Status: Closed
    • Trivial
    • Resolution: Duplicate
    • 4.0.28
    • None
    • Frontend (F)
    • CentOS 7.8.2003(PHP 5.4.16)

    Description

      Problem description:

      After upgrading Zabbix version to 4.0.28 on CentOS 7, an error is recorded in the web server log and the graph cannot be displayed.

      Steps to reproduce:

      1. upgrade to 4.0.28
      2. access Monitoring -> Graphs

      Result:
      The error log recorded in the Web server log is as follows.

      [Tue Jan 26 10:13:58.931000 2021] [:error] [pid 18416] [client 10.34.16.112:58361] PHP Parse error:  syntax error, unexpected ':', expecting ';' or '{' in /usr/share/zabbix/include/classes/graphdraw/CLineGraphDraw.php on line 1305, referer: http://192.168.1.1/zabbix/charts.php?ddreset=1
      

      Expected:
      The graph is displayed without any error being output.

      Suggestion:
      If you check the contents of CLineGraphDraw.php, it uses a description method that is not available in PHP 5.4.16. It is possible to display the graph by changing the description as follows.

      --- CLineGraphDraw.php.orig     2021-01-25 19:14:36.000000000 +0900
      +++ CLineGraphDraw.php  2021-01-26 10:49:14.629427235 +0900
      @@ -1302,7 +1302,7 @@
               *
               * @return array
               */
      -       private function getOptimalDateTimeIntervalSpec(int $pref_sub_interval, float $min_sub_interval): array {
      +       private function getOptimalDateTimeIntervalSpec(int $pref_sub_interval, float $min_sub_interval) {
                      // Possible X-axis main and sub-intervals.
                      $intervals = [
                              'PT1M' => ['PT1S', 'PT5S', 'PT10S', 'PT30S'],
      @@ -1382,7 +1382,7 @@
               *
               * @return array
               */
      -       private function getDateTimeIntervals(int $start, int $end, DateInterval $interval): array {
      +       private function getDateTimeIntervals(int $start, int $end, DateInterval $interval) {
                      $intervals = [];                $interval_ts = (new DateTime('@0'))

      Attachments

        Issue Links

          Activity

            People

              zabbix.dev Zabbix Development Team
              atanaka Atsushi Tanaka
              Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: