- 
    Problem report 
- 
    Resolution: Duplicate
- 
    Trivial 
- 
    None
- 
    4.0.28
- 
    CentOS 7.8.2003(PHP 5.4.16)
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:
- upgrade to 4.0.28
- 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'))