com php-src: Fix bug #72596: imagetypes function won't advertise WEBP support: NEWS UPGRADING ext/gd/gd.c ext/gd/tests/bug72596.phpt
| From: | Christoph Michael Becker | Date: | Thu, 14 Jul 2016 15:17:59 +0000 |
| Subject: | com php-src: Fix bug #72596: imagetypes function won't advertise WEBP support: NEWS UPGRADING ext/gd/gd.c ext/gd/tests/bug72596.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-93014@lists.php.net to get a copy of this message | ||
Commit: 8bb3bd04a9d38c08dce0034ad8fc1263631d28ff
Author: Christoph M. Becker <cmb@php.net> Thu, 14 Jul 2016 16:43:13 +0200
Parents: 3cc4265527c7d97c3b87054f5ce46cf37351688c
Branches: PHP-5.6 PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8bb3bd04a9d38c08dce0034ad8fc1263631d28ff
Log:
Fix bug #72596: imagetypes function won't advertise WEBP support
We add the constant IMG_WEBP and make sure that WebP support is properly
reported by imagetypes()..
Bugs:
https://bugs.php.net/72596
Changed paths:
M NEWS
M UPGRADING
M ext/gd/gd.c
A ext/gd/tests/bug72596.phpt
Diff:
diff --git a/NEWS b/NEWS
index 79d4504..a9d242b 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,9 @@ PHP NEWS
. Fixed bug #72575 (using --allow-to-run-as-root should ignore missing user).
(gooh)
+- GD:
+ . Fixed bug #72596 (imagetypes function won't advertise WEBP support). (cmb)
+
- Intl:
. Partially fixed #72506 (idn_to_ascii for UTS #46 incorrect for long domain
names). (cmb)
diff --git a/UPGRADING b/UPGRADING
index e2cf5a7..dbf6501 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -400,6 +400,9 @@ PHP 5.6 UPGRADE NOTES
- CURL:
CURL_HTTP_VERSION_2_0 and CURL_VERSION_HTTP2 (>= 5.6.8)
+- GD:
+ IMG_WEBP (>= 5.6.25)
+
- LDAP:
LDAP_ESCAPE_FILTER int(1)
LDAP_ESCAPE_DN int(2)
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index cb070ab..532fc5d 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -1148,6 +1148,7 @@ PHP_MINIT_FUNCTION(gd)
REGISTER_LONG_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_XPM", 16, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_WEBP", 32, CONST_CS | CONST_PERSISTENT);
/* special colours for gd */
REGISTER_LONG_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT);
@@ -2200,6 +2201,9 @@ PHP_FUNCTION(imagetypes)
#if defined(HAVE_GD_XPM)
ret |= 16;
#endif
+#ifdef HAVE_GD_WEBP
+ ret |= 32;
+#endif
if (zend_parse_parameters_none() == FAILURE) {
return;
diff --git a/ext/gd/tests/bug72596.phpt b/ext/gd/tests/bug72596.phpt
new file mode 100644
index 0000000..2eb7dad
--- /dev/null
+++ b/ext/gd/tests/bug72596.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #72596 (imagetypes function won't advertise WEBP support)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+var_dump(function_exists('imagewebp') === (bool) (imagetypes() & IMG_WEBP));
+?>
+--EXPECT--
+bool(true)