[ZBX-24260] PNG graph color scheme wrong when using php 8.1 Created: 2024 Mar 23  Updated: 2025 Jan 22

Status: Confirmed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 6.4.12, 7.0.0beta2
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Ryan Eberly Assignee: Zabbix Development Team
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Rocky Linux 9.3
PHP version 8.1.27 (from AppStream)
Zabbix 7.0.0 beta2


Attachments: PNG File avg-view-php-81.png     PNG File image-2024-03-23-15-03-24-716.png     PNG File image-2024-03-23-15-04-38-301.png    

 Description   

Steps to reproduce:

  1. dnf module reset php
  2. dnf module install php:8.1
  3. open a PNG graph from the Latest data page and observe that the range between min and max is now shaded a very bold green color that matches the average line
  4. dnf module reset php
  5. dnf downgrade php (back to 8.0.30)
  6. open a PNG graph and observe the expected PNG color scheme.

Expected

1. the shaded area between min and max should be the typical gold/yellow color

 

Running PHP 8.1.27:

Running PHP 8.0.30



 Comments   
Comment by Aigars Kadikis [ 2024 Mar 25 ]

I can confirm a similar behaviour with PHP 8.1.27 and 6.4.12 frontend and light theme.
In the trends view, the AVG line is there, but barely noticeable:

Comment by Ryan Eberly [ 2025 Jan 22 ]

aigars.kadikis - I'm coming back to this problem now primarily because PHP 8.0 is end of life and for security reasons I need to upgrade to PHP 8.2 at minimum. I did a bit more research and found the ZBX ticket that introduced the color changes referenced above: ZBXNEXT-7722

 

Is there any plan to look at and fix this ticket? I know there have been tickets submitted to the queue to switch completely to SVG graphs, which is truly preferred over these classic graphs, But, a minimum fix so that the color scheme contrasts until then is necessary. What do you think?

Comment by Ryan Eberly [ 2025 Jan 22 ]

One more piece of information:

 

Currently in ui/include/classes/graphdraw/CLineGraphDraw.php on line 1782 seems to be where the problem is at. If I replace line 1782 with the contents of line 1785, then the color scheme is fixed. Additionally, I have not observed any PHP runtime errors as a result of this change on PHP 8.2. Perhaps this is an adequate fix to this problem in the meantime?

Generated at Sat Apr 19 03:36:39 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.