# Workaround for bug #15797 (inconsistent error behaviour with GD)

- Thread: https://externals.io/message/132
- Original archive: https://news-web.php.net/php.internals/132
- Started by Antoine on 2003-03-21T16:00:10+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #132 — Antoine — 2003-03-21T16:00:10+00:00

URL: https://externals.io/message/132#132

Hi,

Some users of our program SPIP are stumbling onto the following bug :
http://bugs.php.net/bug.php?id=15797

See my comment at the end. It seems several PHP versions are plagued
by this problem. I'd like to find a way to circumvent it, because
we need our program to work with all PHP & GD versions. Unfortunately
the fact that a fatal error is yielded when calling imagecreatetruecolor
with the wrong GD version makes it seemingly impossible.

Does anybody have an answer to this ?

(note : another bug seems identical : http://bugs.php.net/bug.php?id=16002)

Thanks

Antoine.

---

## #135 — Mats Lindh — 2003-03-21T17:39:21+00:00

URL: https://externals.io/message/132#135 · In reply to: #132

- %antoine@rezo.net% (Antoine):
> See my comment at the end. It seems several PHP versions are plagued
> by this problem. I'd like to find a way to circumvent it, because
> we need our program to work with all PHP & GD versions. Unfortunately
> the fact that a fatal error is yielded when calling imagecreatetruecolor
> with the wrong GD version makes it seemingly impossible.
> 
> Does anybody have an answer to this ?
> 
> (note : another bug seems identical : http://bugs.php.net/bug.php?id=16002)

As the post says, this was fixed in CVS at the time. The change should
be available in PHP 4.3.x, where the functions availbility could be
checked with functions_exists(). There is also a function named
gd_info() which provides version information in PHP 4.3.x. Prior to
this I think you'll have to create something which parses the output
from `phpinfo()` for more information. For further assistance on that,
contact php-general@lists.php.net.

-- 
mats

---

## #139 — Antoine — 2003-03-21T18:58:25+00:00

URL: https://externals.io/message/132#139 · In reply to: #135

Hi,

> As the post says, this was fixed in CVS at the time. The change should
> be available in PHP 4.3.x, where the functions availbility could be
> checked with functions_exists().

Well, PHP 4.3 solves the problem by embedding its own GD version anyway 
;-)

> There is also a function named
> gd_info() which provides version information in PHP 4.3.x. Prior to
> this I think you'll have to create something which parses the output
> from `phpinfo()` for more information. For further assistance on that,
> contact php-general@lists.php.net.

Well, if I'm in the mood for ugly hacks, I may use output buffering
to get back `phpinfo()` results... Otherwise what I'm gonna do is probably
to disable high-quality thumbnails (a.k.a. ImageCreateTrueColor and 
ImageCopyResampled) on versions below 4.3.0. If people ask why this
is the case, I'll explain that their PHP version is badly coded 
and forbids us to do a runtime check for these functions...

Thank you for your answer,

Regards

Antoine.
