array_init() can no longer fail, because it means that ZE was unable to allocate memory at which point ZE will cease the script execution. So, if there are any existing checks for return value of array_init() or any other e* memory allocation functions, those checks can be safely removed since they will never happen.
Ilia On December 5, 2002 07:47 am, Marcus Boerger wrote: > helly Thu Dec 5 07:47:22 2002 EDT > > Modified files: (Branch: PHP_4_3) > /php4/ext/standard image.c > Log: > MFH: swc & zlib\nMFH: return FALSE > > > Index: php4/ext/standard/image.c > diff -u php4/ext/standard/image.c:1.72.2.4 > php4/ext/standard/image.c:1.72.2.5 --- > php4/ext/standard/image.c:1.72.2.4 Mon Nov 18 11:53:04 2002 > +++ php4/ext/standard/image.c Thu Dec 5 07:47:22 2002 > @@ -17,7 +17,7 @@ > > +----------------------------------------------------------------------+ */ > > -/* $Id: image.c,v 1.72.2.4 2002/11/18 16:53:04 helly Exp $ */ > +/* $Id: image.c,v 1.72.2.5 2002/12/05 12:47:22 helly Exp $ */ > > #include "php.h" > #include <stdio.h> > @@ -80,7 +80,9 @@ > REGISTER_LONG_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, > CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IMAGETYPE_JPX", > IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT); > REGISTER_LONG_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, > CONST_CS | CONST_PERSISTENT); +#if HAVE_ZLIB > REGISTER_LONG_CONSTANT("IMAGETYPE_SWC", IMAGE_FILETYPE_SWC, > CONST_CS | CONST_PERSISTENT); +#endif > REGISTER_LONG_CONSTANT("IMAGETYPE_IFF", IMAGE_FILETYPE_IFF, > CONST_CS | CONST_PERSISTENT); return SUCCESS; > } > @@ -823,6 +825,7 @@ > int arg_c = ZEND_NUM_ARGS(); > > if ((arg_c!=1) || zend_get_parameters_ex(arg_c, &p_image_type) == > FAILURE) { + RETVAL_FALSE; > WRONG_PARAM_COUNT; > } > convert_to_long_ex(p_image_type); > @@ -894,6 +897,7 @@ > > case 1: > if (zend_get_parameters_ex(1, &arg1) == FAILURE) { > + RETVAL_FALSE; > WRONG_PARAM_COUNT; > } > convert_to_string_ex(arg1); > @@ -901,20 +905,21 @@ > > case 2: > if (zend_get_parameters_ex(2, &arg1, &info) == FAILURE) { > + RETVAL_FALSE; > WRONG_PARAM_COUNT; > } > zval_dtor(*info); > > if (array_init(*info) == FAILURE) { > - return; > + RETURN_FALSE; > } > > convert_to_string_ex(arg1); > break; > > default: > + RETVAL_FALSE; > WRONG_PARAM_COUNT; > - break; > } > > stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), "rb", > REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE, NULL); @@ -974,7 +979,7 @@ > if (array_init(return_value) == FAILURE) { > php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize > array"); efree(result); > - return; > + RETURN_FALSE; > } > add_index_long(return_value, 0, result->width); > add_index_long(return_value, 1, result->height); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php