#69045 closed defect (fixed)
php83-gd: imagefontwidth and imagefontheight fail on valid GDFont
Reported by: | jonaskohl (Jonas Kohl) | Owned by: | ryandesign (Ryan Carsten Schmidt) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.8.1 |
Keywords: | Cc: | jonaskohl (Jonas Kohl) | |
Port: | php83-gd |
Description
When using imagefontwidth($font);
with a font loaded using imageloadfont(...)
, the call fails with the following exception:
Uncaught TypeError: imagefontwidth(): Argument #1 ($font) must be of type GdFont|int, GdFont given
This is not reproducible on non macOS systems, so it seems to be a problem with this port.
I have attached a simple MVP that reproduces this problem (at least on my Mac). Just run sample.php
via php-cli
.
Attachments (1)
Change History (11)
Changed 10 months ago by jonaskohl (Jonas Kohl)
Attachment: | ImageFontWith_Sample.zip added |
---|
comment:1 Changed 10 months ago by jonaskohl (Jonas Kohl)
Cc: | jonaskohl added |
---|
comment:2 Changed 10 months ago by jmroot (Joshua Root)
Owner: | set to ryandesign |
---|---|
Status: | new → assigned |
Summary: | imagefontwidth and imagefontheight fail on valid GDFont → php83-gd: imagefontwidth and imagefontheight fail on valid GDFont |
comment:3 Changed 10 months ago by ryandesign (Ryan Carsten Schmidt)
Replying to jonaskohl:
Just run
sample.php
viaphp-cli
.
I get:
% php83 sample.php 9 15 12 20 % port installed php83{,-gd} The following ports are currently installed: php83 @8.3.1_0+libedit (active) php83-gd @8.3.1_0 (active) %
comment:4 Changed 10 months ago by jonaskohl (Jonas Kohl)
I get the following output:
% php83 sample.php 9 15 PHP Fatal error: Uncaught TypeError: imagefontwidth(): Argument #1 ($font) must be of type GdFont|int, GdFont given in /Users/jonas/Desktop/sample.php:12 Stack trace: #0 /Users/jonas/Desktop/sample.php(12): imagefontwidth(Object(GdFont)) #1 {main} thrown in /Users/jonas/Desktop/sample.php on line 12 Fatal error: Uncaught TypeError: imagefontwidth(): Argument #1 ($font) must be of type GdFont|int, GdFont given in /Users/jonas/Desktop/sample.php:12 Stack trace: #0 /Users/jonas/Desktop/sample.php(12): imagefontwidth(Object(GdFont)) #1 {main} thrown in /Users/jonas/Desktop/sample.php on line 12 % port installed php83{,-gd} The following ports are currently installed: php83 @8.3.1_0+libedit (active) php83-gd @8.3.1_0 (active)
comment:5 Changed 10 months ago by ryandesign (Ryan Carsten Schmidt)
I can't explain it. The error message seems to be saying that you must supply imagefontwidth
with either a GdFont
or an int
and that you have supplied a GdFont
so I don't know what the problem is.
What we do at MacPorts is make other people's software easy to install on a Mac, but we are not experts in that software or how to fix its code if it doesn't work correctly, so I think you should report it to the developers of PHP.
comment:6 Changed 10 months ago by ryandesign (Ryan Carsten Schmidt)
One thing you could try is check if you have any other active php83 modules:
port installed active and name:^php83-
If so, try deactivating them and see if the problem disappears. If it does, isolate which of the other modules is causing the problem.
comment:7 follow-up: 8 Changed 10 months ago by jonaskohl (Jonas Kohl)
I've now deactivated every php83 module except GD (and the core PHP port itself of course), but the problem still occurs. I will now report this bug over at php-src. But as I said, I could not reproduce this on non-mac systems. For example, it worked just fine inside an Ubuntu Docker container.
comment:8 Changed 10 months ago by ryandesign (Ryan Carsten Schmidt)
Replying to jonaskohl:
I will now report this bug over at php-src.
Thanks, I see you reported it here: https://github.com/php/php-src/issues/13082
comment:9 Changed 10 months ago by ryandesign (Ryan Carsten Schmidt)
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Archive of MVP