com php-src: Fix #70047: gd_info() doesn't report WebP support: ext/gd/gd.c ext/gd/tests/bug70 047.phpt
| From: | Christoph Michael Becker | Date: | Sat, 11 Jul 2015 15:49:13 +0000 |
| Subject: | com php-src: Fix #70047: gd_info() doesn't report WebP support: ext/gd/gd.c ext/gd/tests/bug70 047.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87922@lists.php.net to get a copy of this message | ||
Commit: 450fbdc74079a23db83430c6035cdbb7d83e4d1b
Author: Christoph M. Becker <cmb@php.net> Sat, 11 Jul 2015 17:49:13 +0200
Parents: 49c0c1299a3242df18f3b7f519925fd2a0c20bbc
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=450fbdc74079a23db83430c6035cdbb7d83e4d1b
Log:
Fix #70047: gd_info() doesn't report WebP support
Despite being documented, the array returned by gd_info() doesn't have a 'WebP
Support' key. This patch adds it.
Bugs:
https://bugs.php.net/70047
Changed paths:
M ext/gd/gd.c
A ext/gd/tests/bug70047.phpt
Diff:
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 72c2d48..a16cf0a 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -1405,6 +1405,11 @@ PHP_FUNCTION(gd_info)
add_assoc_bool(return_value, "XPM Support", 0);
#endif
add_assoc_bool(return_value, "XBM Support", 1);
+#ifdef HAVE_GD_WEBP
+ add_assoc_bool(return_value, "WebP Support", 1);
+#else
+ add_assoc_bool(return_value, "WebP Support", 0);
+#endif
#if defined(USE_GD_JISX0208)
add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 1);
#else
diff --git a/ext/gd/tests/bug70047.phpt b/ext/gd/tests/bug70047.phpt
new file mode 100644
index 0000000..7dbf8ab
--- /dev/null
+++ b/ext/gd/tests/bug70047.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #70047 (gd_info() doesn't report WebP support)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+$info = gd_info();
+var_dump(array_key_exists('WebP Support', $info));
+var_dump($info['WebP Support'] === function_exists('imagewebp'));
+?>
+--EXPECT--
+bool(true)
+bool(true)