From: Pierre Joye Date: Tue, 17 Jan 2006 15:44:12 +0000 (+0000) Subject: - return false on error X-Git-Tag: php-5.1.3RC1~245 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=afa77062d1efb94d2f9a1a7c29f1e55687511027;p=php - return false on error --- diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 9aa328c538..150a63afd8 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1967,6 +1967,7 @@ PHP_FUNCTION(imagecolorallocate) { zval **IM, **red, **green, **blue; gdImagePtr im; + int ct = (-1); if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); @@ -1977,8 +1978,11 @@ PHP_FUNCTION(imagecolorallocate) convert_to_long_ex(red); convert_to_long_ex(green); convert_to_long_ex(blue); - - RETURN_LONG(gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue))); + ct = gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)); + if (ct < 0) { + RETURN_FALSE; + } + RETURN_LONG(ct); } /* }}} */