Bug #72596 [Opn->Ver]: imagetypes function won't advertise WEBP support
| From: | cmb@php.net | Date: | Thu, 14 Jul 2016 14:13:34 +0000 |
| Subject: | Bug #72596 [Opn->Ver]: imagetypes function won't advertise WEBP support | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-202324@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72596&edit=1
ID: 72596
Updated by: cmb@php.net
Reported by: chris at ocproducts dot com
Summary: imagetypes function won't advertise WEBP support
-Status: Open
+Status: Verified
Type: Bug
Package: GD related
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Thanks for the report.
> Personally I'd recommend just dropping the function, [â¦]
Due to backward compatibility reasons, that would have to be
postponed to a major (or maybe minor) version, and would require
an RFC, and most likely a deprecation phase. The bug would have,
however, to be fixed for PHP 5.6+ anyway.
Previous Comments:
------------------------------------------------------------------------
[2016-07-14 12:52:25] chris at ocproducts dot com
Description:
------------
The imagetypes function will not return a bitmask value for if WEBP support is available, which is
available with read/write since PHP 5.5. All other formats are currently covered (except for GD
which is implied, and XBM which is implied by XPM).
Here's the code from PHP7 to confirm...
/* {{{ proto int imagetypes(void)
Return the types of images supported in a bitfield - 1=GIF, 2=JPEG, 4=PNG, 8=WBMP, 16=XPM */
PHP_FUNCTION(imagetypes)
{
int ret=0;
ret = 1;
#ifdef HAVE_GD_JPG
ret |= 2;
#endif
#ifdef HAVE_GD_PNG
ret |= 4;
#endif
ret |= 8;
#if defined(HAVE_GD_XPM)
ret |= 16;
#endif
if (zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_LONG(ret);
}
Personally I'd recommend just dropping the function, given that GD-Info returns details in its
report and you can just use function_exists. Removing a function and a set of constants may lower
the PHP overhead slightly. But if it stays it should be consistent with what PHP can do.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72596&edit=1