Welcome! Log In Create A New Profile

Advanced

[PHP-DEV] What to do with bundled GD's version info?

Posted by Christoph M. Becker 
Christoph M. Becker
[PHP-DEV] What to do with bundled GD's version info?
February 02, 2018 11:50PM
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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Andrea Faulds
[PHP-DEV] Re: What to do with bundled GD's version info?
February 05, 2018 03:40AM
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/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Christoph M. Becker
[PHP-DEV] Re: What to do with bundled GD's version info?
February 06, 2018 07:40PM
Hi Andrea!

On 05.02.2018 at 03:35, Andrea Faulds wrote:

> 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! 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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, only registered users may post in this forum.

Click here to login