Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text not rendered correctly as an image with the packaged libgd3 version #2236

Open
3 tasks done
trantor opened this issue Nov 27, 2024 · 6 comments
Open
3 tasks done

Comments

@trantor
Copy link

trantor commented Nov 27, 2024

Frequently asked questions

  • I have read Frequently Asked Questions
  • I have looked at the list of the existing issues (including closed issues) and searched if my issue has been already reported
  • I have tried to resolve the issue myself and will describe what I did in clear and concise manner

Describe the bug
I run an instance of Zabbix whose web interface runs on a local PHP 8.3 (FPM) installation sourced from the Ubuntu PPA.
After upgrading to Ubuntu 24.04.1 and PHP 8.3 we noticed a problem in the image rendering of graphs, which is accomplished by the web interface through the PHP GD extension.

A normal rendering would look something like this

image

What we would get instead is
image

Going through the code I tracked the problem to a imagettftext call at https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/ui/include/graphs.inc.php#476

The text rendered as an image appears to be squashed horizontally.

I then tried bringing the libgd3 package for the GD library back from version 2.3.3-12+ubuntu24.04.1+deb.sury.org+1 to the distro stock version 2.3.3-9ubuntu5 and restarted the php8.3-fpm service.
And the text rendering went back to normal.

Another thing is that installing the PPA version installed as depedencies the libraries below, which get uninstalled by switching back to the stock Ubuntu version of libgd3

Setting up libgraphite2-3:arm64 (1.3.14-2build1) ...
Setting up libsvtav1enc1d1:arm64 (1.7.0+dfsg-2build1) ...
Setting up librav1e0:arm64 (0.7.1-2) ...
Setting up libimagequant0:arm64 (2.18.0-1build1) ...
Setting up libdav1d7:arm64 (1.4.1-1build1) ...
Setting up libharfbuzz0b:arm64 (8.3.0-2build2) ...
Setting up libabsl20220623t64:arm64 (20220623.1-3.1ubuntu3) ...
Setting up libyuv0:arm64 (0.0~git202401110.af6ac82-1) ...
Setting up libraqm0:arm64 (0.10.1-1build1) ...
Setting up libgav1-1:arm64 (0.18.0-1build3) ...
Setting up libavif16:arm64 (1.0.4-1ubuntu3) ...
Setting up libgd3:arm64 (2.3.3-12+ubuntu24.04.1+deb.sury.org+1) ...

This is also likely the cause of the similar-looking https://support.zabbix.com/browse/ZBX-25191

To Reproduce
Hard to provide a simple way. Probably some simple PHP code using the imagettftext function would do the trick.

Your understanding of what is happening
Something with the patches to the gd library code to compile this package is causing text rendered as an image to be squashed horizontally.

What steps did you take to resolve issue yourself before reporting it here
I looked through the stack of the image rendering until I arrived to the underlying GD library. Substituting it with a "stock" version solved the problem, hence the packaged version is likely the problem

Expected behavior
For text to be rendered legibly as an image through the PHP GD extension and the underlying GD library

Distribution (please complete the following information):

  • OS: Ubuntu 24.04.1
  • Architecture: arm64
  • Repository: Ubuntu PPA

Package(s) (please complete the following information):

libgd3:
  Installed: 2.3.3-9ubuntu5
  Candidate: 2.3.3-12+ubuntu24.04.1+deb.sury.org+1
  Version table:
     2.3.3-12+ubuntu24.04.1+deb.sury.org+1 500
        500 http://ppa.launchpad.net/ondrej/php/ubuntu noble/main arm64 Packages
 *** 2.3.3-9ubuntu5 500
        500 http://eu-west-1.ec2.ports.ubuntu.com/ubuntu-ports noble/main arm64 Packages
        100 /var/lib/dpkg/status

The listing above is after switching back to the stock Ubuntu package

Additional context
I am unsure whether the arm64 architecture might have an impact on the issue.

@selivan
Copy link

selivan commented Nov 28, 2024

I confirm this bug. Software versions:

  • OS: ubuntu 24.04
  • libgd3:arm64 2.3.3-12+ubuntu24.04.1+deb.sury.org+1
  • zabbix-frontend-php 7.0.6

@trantor
Copy link
Author

trantor commented Dec 2, 2024

Actually, the patchset seems to be identical to the one from the official Ubuntu distribution. What changes are the dependencies. The Ubuntu package is not built with dependencies on libramq, libavif, libimagequant .

@oerdnj
Copy link
Owner

oerdnj commented Dec 2, 2024

My guess is that the bug is somewhere in the support for rendering RTL languages. But I would need a reproducer to see what should be disabled or fixed. Perhaps filling this against upstream libgd might also help? Someone might take a look, but reproducer would be really useful.

@oerdnj oerdnj closed this as completed Dec 2, 2024
@oerdnj oerdnj reopened this Dec 2, 2024
@trantor
Copy link
Author

trantor commented Dec 2, 2024

@oerdnj yep, that would make sense to me as well. Although this issue libgd/libgd#887 seems to fit the bill quite well.

@trantor
Copy link
Author

trantor commented Dec 2, 2024

@oerdnj in the issue mentioned above they seem to imply that the libgd code was fixed in 2022 but the debian package has not incorporated the fix.

@oerdnj
Copy link
Owner

oerdnj commented Dec 3, 2024

in the issue mentioned above they seem to imply that the libgd code was fixed in 2022 but the debian package has not incorporated the fix.

Nope, this was only fixed in the embedded version of libgd, but not in any official libgd release (the 2.4 is not yet out).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants