# What to do with bundled GD's version info?

- Thread: https://externals.io/message/101744
- Original archive: https://news-web.php.net/php.internals/101744
- Started by Christoph M. Becker on 2018-02-02T22:45:58+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

---

## #101744 — Christoph M. Becker — 2018-02-02T22:45:58+00:00

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

Hi everybody!

Please consider the following script:

  <?php
  echo gd_info()['GD Version'], PHP_EOL,
      GD_MAJOR_VERSION, '.', GD_MINOR_VERSION, '.',
      GD_RELEASE_VERSION, PHP_EOL;

If PHP is compiled with the *bundled* libgd, it outputs since at least
PHP 5.3.25/5.4.1:

  bundled (2.1.0 compatible)
  2.0.35

Obviously, that would mean there have been no relevant changes to the
bundled libgd for years, which is not true.  Even worse, there has never
been a bundled libgd version which was fully compatible to system libgd
2.1.0, ever.  Presently, we're somewhat close to libgd 2.2.5, but still
we couldn't claim full compatibility.  Of course, in the long run the
goal is to finally bundle an unmodified copy of the upstream library,
but for now that appears out of reach.

So the question is how to handle the version information of the bundled
libgd for the time being.   With regard to gd_info()['GD Version'] just
saying "bundled" (without any compatibility statement) might be a good
solution.  However, I'm at a loss how to handle GD_*_VERSION.  Any ideas?

-- 
Christoph M. Becker

---

## #101765 — Andrea Faulds — 2018-02-05T02:35:24+00:00

URL: https://externals.io/message/101744#101765 · In reply to: #101744

Hi Christoph,

Christoph M. Becker wrote:
> So the question is how to handle the version information of the bundled
> libgd for the time being.   With regard to gd_info()['GD Version'] just
> saying "bundled" (without any compatibility statement) might be a good
> solution.  However, I'm at a loss how to handle GD_*_VERSION.  Any ideas?

This might be a bit… maverick, but I wonder if we could get away with a 
semi-numeric string constant. The string "2-phpbundled" would compare 
greater than or equal to 2:

$ php -r 'var_dump("2-phpbundled" == 2);'
bool(true)
$ php -r 'var_dump("2-phpbundled" >= 2);'
bool(true)

The problem is that, well, some code out there might want an actual 
integer. It's also a bit ugly…

Thanks.
-- 
Andrea Faulds
https://ajf.me/

---

## #101785 — Christoph M. Becker — 2018-02-06T18:32:49+00:00

URL: https://externals.io/message/101744#101785 · In reply to: #101765

Hi Andrea!



> Christoph M. Becker wrote:
>
> > […]
> 
> This might be a bit… maverick, but I wonder if we could get away with a
> semi-numeric string constant. The string "2-phpbundled" would compare
> greater than or equal to 2:
> 
> $ php -r 'var_dump("2-phpbundled" == 2);'
> bool(true)
> $ php -r 'var_dump("2-phpbundled" >= 2);'
> bool(true)
> 
> The problem is that, well, some code out there might want an actual
> integer. It's also a bit ugly…

Thanks!  I don't think this would be helpful, though, since GD 2.0 has
been released around the millenium, and GD 2.0.1 has already been
bundled with PHP since at least PHP 4.3.0.  Therefore we can safely
assume that nobody uses GD 1 anymore.

After reconsideration, it seems to me that we simply can drop the
GD_*_VERSION constants for the bundled libgd.  Anybody who would using
them in combination with the bundled GD is likely to have buggy code,
anyway.  The only sensible thing to do currently would be to check for
`GD_BUNDLED` and to check the PHP version.

I've submitted a respective PR: <https://github.com/php/php-src/pull/3080>.

-- 
Christoph M. Becker
