summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/gd/gd.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 3065fd81b2..f090f1d63d 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -1721,7 +1721,9 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
switch (image_type) {
case PHP_GDIMG_CONVERT_WBM:
- if (q < 0 || q > 255) {
+ if (q == -1) {
+ q = 0;
+ } else if (q < 0 || q > 255) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
q = 0;
}
@@ -1766,9 +1768,12 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
switch (image_type) {
case PHP_GDIMG_CONVERT_WBM:
- if (q < 0 || q > 255) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
- }
+ if (q == -1) {
+ q = 0;
+ } else if (q < 0 || q > 255) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
+ q = 0;
+ }
gdImageWBMP(im, q, tmp);
break;
case PHP_GDIMG_TYPE_JPG: