imagetypes function won't advertise WEBP support
| Bug #72596 | imagetypes function won't advertise WEBP support | ||||
|---|---|---|---|---|---|
| Submitted: | 2016-07-14 12:52 UTC | Modified: | 2016-07-14 14:13 UTC | ||
| From: | chris at ocproducts dot com | Assigned: | cmb (profile) | ||
| Status: | Closed | Package: | GD related | ||
| PHP Version: | Irrelevant | OS: | |||
| Private report: | No | CVE-ID: | None | ||
[2016-07-14 12:52 UTC] 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.
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2016-07-14 14:13 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
[2016-07-14 14:13 UTC] cmb@php.net
[2016-07-14 15:31 UTC] cmb@php.net
-Status: Verified +Status: Closed