Use RETURN_THROWS() in various places

This commit is contained in:
Máté Kocsis 2020-01-03 20:44:29 +01:00
parent bbcfa66e06
commit aadd3aaed9
No known key found for this signature in database
GPG key ID: FD055E41728BF310
33 changed files with 84 additions and 83 deletions

View file

@ -62,13 +62,13 @@ PHP_FUNCTION(com_create_instance)
ZEND_NUM_ARGS(), "sa|ls", ZEND_NUM_ARGS(), "sa|ls",
&module_name, &module_name_len, &server_params, &cp, &module_name, &module_name_len, &server_params, &cp,
&typelib_name, &typelib_name_len)) { &typelib_name, &typelib_name_len)) {
return; RETURN_THROWS();
} }
cp_it = php_win32_cp_get_by_id((DWORD)cp); cp_it = php_win32_cp_get_by_id((DWORD)cp);
if (!cp_it) { if (!cp_it) {
php_com_throw_exception(E_INVALIDARG, "Could not create COM object - invalid codepage!"); php_com_throw_exception(E_INVALIDARG, "Could not create COM object - invalid codepage!");
return; RETURN_THROWS();
} }
obj->code_page = (int)cp; obj->code_page = (int)cp;
@ -116,7 +116,7 @@ PHP_FUNCTION(com_create_instance)
if (server_name && !COMG(allow_dcom)) { if (server_name && !COMG(allow_dcom)) {
php_com_throw_exception(E_ERROR, "DCOM has been disabled by your administrator [com.allow_dcom=0]"); php_com_throw_exception(E_ERROR, "DCOM has been disabled by your administrator [com.allow_dcom=0]");
return; RETURN_THROWS();
} }
moniker = php_com_string_to_olestring(module_name, module_name_len, obj->code_page); moniker = php_com_string_to_olestring(module_name, module_name_len, obj->code_page);
@ -231,7 +231,7 @@ PHP_FUNCTION(com_create_instance)
php_com_throw_exception(res, msg); php_com_throw_exception(res, msg);
efree(msg); efree(msg);
return; RETURN_THROWS();
} }
/* we got the object and it lives ! */ /* we got the object and it lives ! */

View file

@ -205,7 +205,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
snprintf(buf, sizeof(buf), "Failed to init .Net runtime [%s] %s", where, err); snprintf(buf, sizeof(buf), "Failed to init .Net runtime [%s] %s", where, err);
php_win32_error_msg_free(err); php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf); php_com_throw_exception(hr, buf);
return; RETURN_THROWS();
} }
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff); stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
@ -219,7 +219,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
php_win32_error_msg_free(err); php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf); php_com_throw_exception(hr, buf);
ZVAL_NULL(object); ZVAL_NULL(object);
return; RETURN_THROWS();
} }
where = "QI: System._AppDomain"; where = "QI: System._AppDomain";
@ -231,7 +231,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
php_win32_error_msg_free(err); php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf); php_com_throw_exception(hr, buf);
ZVAL_NULL(object); ZVAL_NULL(object);
return; RETURN_THROWS();
} }
} }
@ -247,7 +247,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
cp_it = php_win32_cp_get_by_id((DWORD)cp); cp_it = php_win32_cp_get_by_id((DWORD)cp);
if (!cp_it) { if (!cp_it) {
php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid codepage!"); php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid codepage!");
return; RETURN_THROWS();
} }
obj->code_page = (int)cp_it->id; obj->code_page = (int)cp_it->id;
@ -311,7 +311,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
snprintf(buf, sizeof(buf), "Failed to instantiate .Net object [%s] [0x%08x] %s", where, hr, err); snprintf(buf, sizeof(buf), "Failed to instantiate .Net object [%s] [0x%08x] %s", where, hr, err);
php_win32_error_msg_free(err); php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf); php_com_throw_exception(hr, buf);
return; RETURN_THROWS();
} }
} }
/* }}} */ /* }}} */

View file

@ -289,7 +289,7 @@ PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream)
#define CPH_FETCH() php_com_persist_helper *helper = (php_com_persist_helper*)Z_OBJ_P(getThis()); #define CPH_FETCH() php_com_persist_helper *helper = (php_com_persist_helper*)Z_OBJ_P(getThis());
#define CPH_NO_OBJ() if (helper->unk == NULL) { php_com_throw_exception(E_INVALIDARG, "No COM object is associated with this helper instance"); return; } #define CPH_NO_OBJ() if (helper->unk == NULL) { php_com_throw_exception(E_INVALIDARG, "No COM object is associated with this helper instance"); RETURN_THROWS(); }
typedef struct { typedef struct {
zend_object std; zend_object std;
@ -490,7 +490,7 @@ CPH_METHOD(GetMaxStreamSize)
res = IPersistStream_GetSizeMax(helper->ips, &size); res = IPersistStream_GetSizeMax(helper->ips, &size);
} else { } else {
php_com_throw_exception(res, NULL); php_com_throw_exception(res, NULL);
return; RETURN_THROWS();
} }
} }
@ -545,13 +545,13 @@ CPH_METHOD(LoadFromStream)
if (stream == NULL) { if (stream == NULL) {
php_com_throw_exception(E_INVALIDARG, "expected a stream"); php_com_throw_exception(E_INVALIDARG, "expected a stream");
return; RETURN_THROWS();
} }
stm = php_com_wrapper_export_stream(stream); stm = php_com_wrapper_export_stream(stream);
if (stm == NULL) { if (stm == NULL) {
php_com_throw_exception(E_UNEXPECTED, "failed to wrap stream"); php_com_throw_exception(E_UNEXPECTED, "failed to wrap stream");
return; RETURN_THROWS();
} }
res = S_OK; res = S_OK;
@ -581,7 +581,7 @@ CPH_METHOD(LoadFromStream)
if (FAILED(res)) { if (FAILED(res)) {
php_com_throw_exception(res, NULL); php_com_throw_exception(res, NULL);
RETURN_NULL(); RETURN_THROWS();
} }
} }
/* }}} */ /* }}} */
@ -606,13 +606,13 @@ CPH_METHOD(SaveToStream)
if (stream == NULL) { if (stream == NULL) {
php_com_throw_exception(E_INVALIDARG, "expected a stream"); php_com_throw_exception(E_INVALIDARG, "expected a stream");
return; RETURN_THROWS();
} }
stm = php_com_wrapper_export_stream(stream); stm = php_com_wrapper_export_stream(stream);
if (stm == NULL) { if (stm == NULL) {
php_com_throw_exception(E_UNEXPECTED, "failed to wrap stream"); php_com_throw_exception(E_UNEXPECTED, "failed to wrap stream");
return; RETURN_THROWS();
} }
res = get_persist_stream_init(helper); res = get_persist_stream_init(helper);
@ -629,7 +629,7 @@ CPH_METHOD(SaveToStream)
if (FAILED(res)) { if (FAILED(res)) {
php_com_throw_exception(res, NULL); php_com_throw_exception(res, NULL);
return; RETURN_THROWS();
} }
RETURN_TRUE; RETURN_TRUE;
@ -657,7 +657,7 @@ CPH_METHOD(__construct)
if (V_VT(&obj->v) != VT_DISPATCH || V_DISPATCH(&obj->v) == NULL) { if (V_VT(&obj->v) != VT_DISPATCH || V_DISPATCH(&obj->v) == NULL) {
php_com_throw_exception(E_INVALIDARG, "parameter must represent an IDispatch COM object"); php_com_throw_exception(E_INVALIDARG, "parameter must represent an IDispatch COM object");
return; RETURN_THROWS();
} }
/* it is always safe to cast an interface to IUnknown */ /* it is always safe to cast an interface to IUnknown */

View file

@ -589,7 +589,7 @@ static void variant_binary_operation(enum variant_binary_opcode op, INTERNAL_FUN
php_com_variant_from_zval(vright, zright, codepage); php_com_variant_from_zval(vright, zright, codepage);
} else { } else {
return; RETURN_THROWS();
} }
switch (op) { switch (op) {
@ -775,7 +775,7 @@ static void variant_unary_operation(enum variant_unary_opcode op, INTERNAL_FUNCT
vleft = &left_val; vleft = &left_val;
php_com_variant_from_zval(vleft, zleft, codepage); php_com_variant_from_zval(vleft, zleft, codepage);
} else { } else {
return; RETURN_THROWS();
} }
switch (op) { switch (op) {
@ -873,7 +873,7 @@ PHP_FUNCTION(variant_round)
vleft = &left_val; vleft = &left_val;
php_com_variant_from_zval(vleft, zleft, codepage); php_com_variant_from_zval(vleft, zleft, codepage);
} else { } else {
return; RETURN_THROWS();
} }
if (SUCCEEDED(VarRound(vleft, (int)decimals, &vres))) { if (SUCCEEDED(VarRound(vleft, (int)decimals, &vres))) {
@ -933,7 +933,7 @@ PHP_FUNCTION(variant_cmp)
php_com_variant_from_zval(vright, zright, codepage); php_com_variant_from_zval(vright, zright, codepage);
} else { } else {
return; RETURN_THROWS();
} }
ZVAL_LONG(return_value, VarCmp(vleft, vright, (LCID)lcid, (ULONG)flags)); ZVAL_LONG(return_value, VarCmp(vleft, vright, (LCID)lcid, (ULONG)flags));

View file

@ -598,7 +598,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
/* Exception during string conversion */ /* Exception during string conversion */
if (EG(exception)) { if (EG(exception)) {
FREENOW; FREENOW;
return; RETURN_THROWS();
} }
if (persistent) { if (persistent) {

View file

@ -660,7 +660,7 @@ PHP_FUNCTION(enchant_dict_quick_check)
if (sugg) { if (sugg) {
sugg = zend_try_array_init(sugg); sugg = zend_try_array_init(sugg);
if (!sugg) { if (!sugg) {
return; RETURN_THROWS();
} }
} }

View file

@ -2796,7 +2796,7 @@ static zend_always_inline int zend_ffi_validate_api_restriction(zend_execute_dat
#define ZEND_FFI_VALIDATE_API_RESTRICTION() do { \ #define ZEND_FFI_VALIDATE_API_RESTRICTION() do { \
if (UNEXPECTED(!zend_ffi_validate_api_restriction(execute_data))) { \ if (UNEXPECTED(!zend_ffi_validate_api_restriction(execute_data))) { \
return; \ RETURN_THROWS(); \
} \ } \
} while (0) } while (0)

View file

@ -3342,7 +3342,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
zval *SIM; \ zval *SIM; \
gdImagePtr im_src; \ gdImagePtr im_src; \
if (zend_parse_parameters(1, "O", &SIM, gd_image_ce) == FAILURE) { \ if (zend_parse_parameters(1, "O", &SIM, gd_image_ce) == FAILURE) { \
return; \ RETURN_THROWS(); \
} \ } \
im_src = php_gd_libgdimageptr_from_zval_p(SIM); im_src = php_gd_libgdimageptr_from_zval_p(SIM);

View file

@ -2438,8 +2438,9 @@ PHP_FUNCTION(iconv_set_encoding)
size_t type_len, retval; size_t type_len, retval;
zend_string *name; zend_string *name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sS", &type, &type_len, &charset) == FAILURE) if (zend_parse_parameters(ZEND_NUM_ARGS(), "sS", &type, &type_len, &charset) == FAILURE) {
return; RETURN_THROWS();
}
if (ZSTR_LEN(charset) >= ICONV_CSNMAXLEN) { if (ZSTR_LEN(charset) >= ICONV_CSNMAXLEN) {
php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN); php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);

View file

@ -204,7 +204,7 @@ static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode)
if (idna_info != NULL) { if (idna_info != NULL) {
idna_info = zend_try_array_init(idna_info); idna_info = zend_try_array_init(idna_info);
if (!idna_info) { if (!idna_info) {
return; RETURN_THROWS();
} }
} }

View file

@ -622,7 +622,7 @@ static void _php_ldap_controls_to_array(LDAP *ld, LDAPControl** ctrls, zval* arr
array = zend_try_array_init(array); array = zend_try_array_init(array);
if (!array) { if (!array) {
return; RETURN_THROWS();
} }
if (ctrls == NULL) { if (ctrls == NULL) {
@ -3277,7 +3277,7 @@ PHP_FUNCTION(ldap_set_option)
zend_string *val; zend_string *val;
val = zval_get_string(newval); val = zval_get_string(newval);
if (EG(exception)) { if (EG(exception)) {
return; RETURN_THROWS();
} }
if (ldap_set_option(ldap, option, ZSTR_VAL(val))) { if (ldap_set_option(ldap, option, ZSTR_VAL(val))) {
zend_string_release(val); zend_string_release(val);
@ -3376,7 +3376,7 @@ PHP_FUNCTION(ldap_parse_result)
case 6: case 6:
referrals = zend_try_array_init(referrals); referrals = zend_try_array_init(referrals);
if (!referrals) { if (!referrals) {
return; RETURN_THROWS();
} }
if (lreferrals != NULL) { if (lreferrals != NULL) {
refp = lreferrals; refp = lreferrals;
@ -3559,7 +3559,7 @@ PHP_FUNCTION(ldap_parse_reference)
referrals = zend_try_array_init(referrals); referrals = zend_try_array_init(referrals);
if (!referrals) { if (!referrals) {
return; RETURN_THROWS();
} }
if (lreferrals != NULL) { if (lreferrals != NULL) {

View file

@ -1750,7 +1750,7 @@ PHP_FUNCTION(mb_parse_str)
track_vars_array = zend_try_array_init(track_vars_array); track_vars_array = zend_try_array_init(track_vars_array);
if (!track_vars_array) { if (!track_vars_array) {
return; RETURN_THROWS();
} }
encstr = estrndup(encstr, encstr_len); encstr = estrndup(encstr, encstr_len);

View file

@ -903,7 +903,7 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
if (array != NULL) { if (array != NULL) {
array = zend_try_array_init(array); array = zend_try_array_init(array);
if (!array) { if (!array) {
return; RETURN_THROWS();
} }
} }

View file

@ -1491,7 +1491,7 @@ PHP_FUNCTION(oci_fetch_all)
/* Fetch by Row: array will contain one sub-array per query row */ /* Fetch by Row: array will contain one sub-array per query row */
array = zend_try_array_init(array); array = zend_try_array_init(array);
if (!array) { if (!array) {
return; RETURN_THROWS();
} }
columns = safe_emalloc(statement->ncolumns, sizeof(php_oci_out_column *), 0); columns = safe_emalloc(statement->ncolumns, sizeof(php_oci_out_column *), 0);
@ -1535,7 +1535,7 @@ PHP_FUNCTION(oci_fetch_all)
/* Fetch by columns: array will contain one sub-array per query column */ /* Fetch by columns: array will contain one sub-array per query column */
array = zend_try_array_init_size(array, statement->ncolumns); array = zend_try_array_init_size(array, statement->ncolumns);
if (!array) { if (!array) {
return; RETURN_THROWS();
} }
columns = safe_emalloc(statement->ncolumns, sizeof(php_oci_out_column *), 0); columns = safe_emalloc(statement->ncolumns, sizeof(php_oci_out_column *), 0);

View file

@ -1640,7 +1640,7 @@ PHP_FUNCTION(odbc_fetch_into)
pv_res_arr = zend_try_array_init(pv_res_arr); pv_res_arr = zend_try_array_init(pv_res_arr);
if (!pv_res_arr) { if (!pv_res_arr) {
return; RETURN_THROWS();
} }
#ifdef HAVE_SQL_EXTENDED_FETCH #ifdef HAVE_SQL_EXTENDED_FETCH

View file

@ -605,7 +605,7 @@ PHP_FUNCTION(pcntl_waitpid)
if (z_rusage) { if (z_rusage) {
z_rusage = zend_try_array_init(z_rusage); z_rusage = zend_try_array_init(z_rusage);
if (!z_rusage) { if (!z_rusage) {
return; RETURN_THROWS();
} }
memset(&rusage, 0, sizeof(struct rusage)); memset(&rusage, 0, sizeof(struct rusage));
@ -654,7 +654,7 @@ PHP_FUNCTION(pcntl_wait)
if (z_rusage) { if (z_rusage) {
z_rusage = zend_try_array_init(z_rusage); z_rusage = zend_try_array_init(z_rusage);
if (!z_rusage) { if (!z_rusage) {
return; RETURN_THROWS();
} }
memset(&rusage, 0, sizeof(struct rusage)); memset(&rusage, 0, sizeof(struct rusage));
@ -1084,7 +1084,7 @@ PHP_FUNCTION(pcntl_sigprocmask)
if (user_oldset != NULL) { if (user_oldset != NULL) {
user_oldset = zend_try_array_init(user_oldset); user_oldset = zend_try_array_init(user_oldset);
if (!user_oldset) { if (!user_oldset) {
return; RETURN_THROWS();
} }
for (signo = 1; signo < NSIG; ++signo) { for (signo = 1; signo < NSIG; ++signo) {

View file

@ -1759,7 +1759,7 @@ PHP_METHOD(Phar, buildFromDirectory)
zval_ptr_dtor(&arg); zval_ptr_dtor(&arg);
if (EG(exception)) { if (EG(exception)) {
zval_ptr_dtor(&iter); zval_ptr_dtor(&iter);
RETURN_FALSE; RETURN_THROWS();
} }
if (SUCCESS != object_init_ex(&iteriter, spl_ce_RecursiveIteratorIterator)) { if (SUCCESS != object_init_ex(&iteriter, spl_ce_RecursiveIteratorIterator)) {
@ -1775,7 +1775,7 @@ PHP_METHOD(Phar, buildFromDirectory)
if (EG(exception)) { if (EG(exception)) {
zval_ptr_dtor(&iter); zval_ptr_dtor(&iter);
zval_ptr_dtor(&iteriter); zval_ptr_dtor(&iteriter);
RETURN_FALSE; RETURN_THROWS();
} }
zval_ptr_dtor(&iter); zval_ptr_dtor(&iter);

View file

@ -1352,7 +1352,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
if (EG(exception)) { if (EG(exception)) {
zval_ptr_dtor(&reflector); zval_ptr_dtor(&reflector);
return; RETURN_THROWS();
} }
if (result == FAILURE) { if (result == FAILURE) {
zval_ptr_dtor(&reflector); zval_ptr_dtor(&reflector);
@ -5185,7 +5185,7 @@ ZEND_METHOD(reflection_class, getExtensionName)
zend_class_entry *ce; zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) { if (zend_parse_parameters_none() == FAILURE) {
return; RETURN_THROWS();
} }
GET_REFLECTION_OBJECT_PTR(ce); GET_REFLECTION_OBJECT_PTR(ce);
@ -6300,7 +6300,7 @@ ZEND_METHOD(reflection_reference, getId)
if (!REFLECTION_G(key_initialized)) { if (!REFLECTION_G(key_initialized)) {
if (php_random_bytes_throw(&REFLECTION_G(key_initialized), 16) == FAILURE) { if (php_random_bytes_throw(&REFLECTION_G(key_initialized), 16) == FAILURE) {
return; RETURN_THROWS();
} }
REFLECTION_G(key_initialized) = 1; REFLECTION_G(key_initialized) = 1;

View file

@ -1867,7 +1867,7 @@ PHP_METHOD(SoapServer, addSoapHeader)
SOAP_SERVER_BEGIN_CODE(); SOAP_SERVER_BEGIN_CODE();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &fault, soap_header_class_entry) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &fault, soap_header_class_entry) == FAILURE) {
return; RETURN_THROWS();
} }
FETCH_THIS_SERVICE(service); FETCH_THIS_SERVICE(service);
@ -2137,7 +2137,7 @@ PHP_METHOD(SoapClient, __construct)
zval *this_ptr = ZEND_THIS; zval *this_ptr = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) {
return; RETURN_THROWS();
} }
SOAP_CLIENT_BEGIN_CODE(); SOAP_CLIENT_BEGIN_CODE();
@ -2688,7 +2688,7 @@ PHP_METHOD(SoapClient, __call)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sa|a!zz", if (zend_parse_parameters(ZEND_NUM_ARGS(), "sa|a!zz",
&function, &function_len, &args, &options, &headers, &output_headers) == FAILURE) { &function, &function_len, &args, &options, &headers, &output_headers) == FAILURE) {
return; RETURN_THROWS();
} }
if (options) { if (options) {
@ -2787,7 +2787,7 @@ PHP_METHOD(SoapClient, __getFunctions)
FETCH_THIS_SDL(sdl); FETCH_THIS_SDL(sdl);
if (zend_parse_parameters_none() == FAILURE) { if (zend_parse_parameters_none() == FAILURE) {
return; RETURN_THROWS();
} }
if (sdl) { if (sdl) {
@ -2814,7 +2814,7 @@ PHP_METHOD(SoapClient, __getTypes)
FETCH_THIS_SDL(sdl); FETCH_THIS_SDL(sdl);
if (zend_parse_parameters_none() == FAILURE) { if (zend_parse_parameters_none() == FAILURE) {
return; RETURN_THROWS();
} }
if (sdl) { if (sdl) {
@ -2841,7 +2841,7 @@ PHP_METHOD(SoapClient, __getLastRequest)
zval *tmp; zval *tmp;
if (zend_parse_parameters_none() == FAILURE) { if (zend_parse_parameters_none() == FAILURE) {
return; RETURN_THROWS();
} }
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_request", sizeof("__last_request")-1)) != NULL && if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_request", sizeof("__last_request")-1)) != NULL &&
@ -2860,7 +2860,7 @@ PHP_METHOD(SoapClient, __getLastResponse)
zval *tmp; zval *tmp;
if (zend_parse_parameters_none() == FAILURE) { if (zend_parse_parameters_none() == FAILURE) {
return; RETURN_THROWS();
} }
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_response", sizeof("__last_response")-1)) != NULL && if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_response", sizeof("__last_response")-1)) != NULL &&
@ -2879,7 +2879,7 @@ PHP_METHOD(SoapClient, __getLastRequestHeaders)
zval *tmp; zval *tmp;
if (zend_parse_parameters_none() == FAILURE) { if (zend_parse_parameters_none() == FAILURE) {
return; RETURN_THROWS();
} }
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_request_headers", sizeof("__last_request_headers")-1)) != NULL && if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_request_headers", sizeof("__last_request_headers")-1)) != NULL &&
@ -2898,7 +2898,7 @@ PHP_METHOD(SoapClient, __getLastResponseHeaders)
zval *tmp; zval *tmp;
if (zend_parse_parameters_none() == FAILURE) { if (zend_parse_parameters_none() == FAILURE) {
return; RETURN_THROWS();
} }
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_response_headers", sizeof("__last_response_headers")-1)) != NULL && if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_response_headers", sizeof("__last_response_headers")-1)) != NULL &&
@ -2926,7 +2926,7 @@ PHP_METHOD(SoapClient, __doRequest)
&location, &location_size, &location, &location_size,
&action, &action_size, &action, &action_size,
&version, &one_way) == FAILURE) { &version, &one_way) == FAILURE) {
return; RETURN_THROWS();
} }
if (SOAP_GLOBAL(features) & SOAP_WAIT_ONE_WAY_CALLS) { if (SOAP_GLOBAL(features) & SOAP_WAIT_ONE_WAY_CALLS) {
one_way = 0; one_way = 0;
@ -2956,7 +2956,7 @@ PHP_METHOD(SoapClient, __setCookie)
zval *this_ptr = ZEND_THIS; zval *this_ptr = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!", &name, &name_len, &val, &val_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!", &name, &name_len, &val, &val_len) == FAILURE) {
return; RETURN_THROWS();
} }
if (val == NULL) { if (val == NULL) {
@ -2989,7 +2989,7 @@ PHP_METHOD(SoapClient, __getCookies)
zval *cookies; zval *cookies;
if (zend_parse_parameters_none() == FAILURE) { if (zend_parse_parameters_none() == FAILURE) {
return; RETURN_THROWS();
} }
@ -3012,7 +3012,7 @@ PHP_METHOD(SoapClient, __setSoapHeaders)
zval *this_ptr = ZEND_THIS; zval *this_ptr = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &headers) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &headers) == FAILURE) {
return; RETURN_THROWS();
} }
if (headers == NULL || Z_TYPE_P(headers) == IS_NULL) { if (headers == NULL || Z_TYPE_P(headers) == IS_NULL) {
@ -3050,7 +3050,7 @@ PHP_METHOD(SoapClient, __setLocation)
zval *this_ptr = ZEND_THIS; zval *this_ptr = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &location, &location_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &location, &location_len) == FAILURE) {
return; RETURN_THROWS();
} }
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "location", sizeof("location")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "location", sizeof("location")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) {

View file

@ -181,7 +181,7 @@ PHP_FUNCTION(socket_sendmsg)
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(zsocket), if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(zsocket),
php_sockets_le_socket_name, php_sockets_le_socket())) == NULL) { php_sockets_le_socket_name, php_sockets_le_socket())) == NULL) {
return; RETURN_THROWS();
} }
msghdr = from_zval_run_conversions(zmsg, php_sock, from_zval_write_msghdr_send, msghdr = from_zval_run_conversions(zmsg, php_sock, from_zval_write_msghdr_send,

View file

@ -2068,7 +2068,7 @@ PHP_FUNCTION(socket_create_pair)
if (!fds_array_zval) { if (!fds_array_zval) {
efree(php_sock[0]); efree(php_sock[0]);
efree(php_sock[1]); efree(php_sock[1]);
return; RETURN_THROWS();
} }
php_sock[0]->bsd_socket = fds_array[0]; php_sock[0]->bsd_socket = fds_array[0];

View file

@ -1942,7 +1942,7 @@ SPL_METHOD(CallbackFilterIterator, accept)
} }
if (EG(exception)) { if (EG(exception)) {
RETURN_NULL(); RETURN_THROWS();
} }
/* zend_call_function may change args to IS_REF */ /* zend_call_function may change args to IS_REF */
@ -1984,7 +1984,7 @@ SPL_METHOD(RegexIterator, accept)
/* Exception during string conversion. */ /* Exception during string conversion. */
if (EG(exception)) { if (EG(exception)) {
return; RETURN_THROWS();
} }
switch (intern->u.regex.mode) switch (intern->u.regex.mode)

View file

@ -787,7 +787,7 @@ PHP_FUNCTION(count)
return; return;
} }
if (EG(exception)) { if (EG(exception)) {
return; RETURN_THROWS();
} }
} }
/* if not and the object implements Countable we call its count() method */ /* if not and the object implements Countable we call its count() method */

View file

@ -833,13 +833,13 @@ PHP_FUNCTION(dns_get_record)
if (authns) { if (authns) {
authns = zend_try_array_init(authns); authns = zend_try_array_init(authns);
if (!authns) { if (!authns) {
return; RETURN_THROWS();
} }
} }
if (addtl) { if (addtl) {
addtl = zend_try_array_init(addtl); addtl = zend_try_array_init(addtl);
if (!addtl) { if (!addtl) {
return; RETURN_THROWS();
} }
} }
@ -1069,13 +1069,13 @@ PHP_FUNCTION(dns_get_mx)
mx_list = zend_try_array_init(mx_list); mx_list = zend_try_array_init(mx_list);
if (!mx_list) { if (!mx_list) {
return; RETURN_THROWS();
} }
if (weight_list) { if (weight_list) {
weight_list = zend_try_array_init(weight_list); weight_list = zend_try_array_init(weight_list);
if (!weight_list) { if (!weight_list) {
return; RETURN_THROWS();
} }
} }

View file

@ -363,13 +363,13 @@ PHP_FUNCTION(dns_get_record)
if (authns) { if (authns) {
authns = zend_try_array_init(authns); authns = zend_try_array_init(authns);
if (!authns) { if (!authns) {
return; RETURN_THROWS();
} }
} }
if (addtl) { if (addtl) {
addtl = zend_try_array_init(addtl); addtl = zend_try_array_init(addtl);
if (!addtl) { if (!addtl) {
return; RETURN_THROWS();
} }
} }

View file

@ -236,7 +236,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
} else { } else {
ret_array = zend_try_array_init(ret_array); ret_array = zend_try_array_init(ret_array);
if (!ret_array) { if (!ret_array) {
return; RETURN_THROWS();
} }
} }

View file

@ -1497,7 +1497,7 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) {
if (argc == 2) { if (argc == 2) {
info = zend_try_array_init(info); info = zend_try_array_init(info);
if (!info) { if (!info) {
return; RETURN_THROWS();
} }
} }

View file

@ -213,7 +213,7 @@ PHP_FUNCTION(random_bytes)
if (php_random_bytes_throw(ZSTR_VAL(bytes), size) == FAILURE) { if (php_random_bytes_throw(ZSTR_VAL(bytes), size) == FAILURE) {
zend_string_release_ex(bytes, 0); zend_string_release_ex(bytes, 0);
return; RETURN_THROWS();
} }
ZSTR_VAL(bytes)[size] = '\0'; ZSTR_VAL(bytes)[size] = '\0';

View file

@ -1089,7 +1089,7 @@ PHP_FUNCTION(stream_context_get_default)
if (params) { if (params) {
if (parse_context_options(context, params) == FAILURE) { if (parse_context_options(context, params) == FAILURE) {
return; RETURN_THROWS();
} }
} }
@ -1114,7 +1114,7 @@ PHP_FUNCTION(stream_context_set_default)
context = FG(default_context); context = FG(default_context);
if (parse_context_options(context, options) == FAILURE) { if (parse_context_options(context, options) == FAILURE) {
return; RETURN_THROWS();
} }
php_stream_context_to_zval(context, return_value); php_stream_context_to_zval(context, return_value);

View file

@ -2271,7 +2271,7 @@ PHP_FUNCTION(substr_replace)
if (Z_TYPE_P(from) != IS_ARRAY) { if (Z_TYPE_P(from) != IS_ARRAY) {
convert_to_long_ex(from); convert_to_long_ex(from);
if (EG(exception)) { if (EG(exception)) {
return; RETURN_THROWS();
} }
} }
@ -4316,7 +4316,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit
} }
if (EG(exception)) { if (EG(exception)) {
return; RETURN_THROWS();
} }
/* if subject is an array */ /* if subject is an array */
@ -4794,7 +4794,7 @@ PHP_FUNCTION(parse_str)
arrayArg = zend_try_array_init(arrayArg); arrayArg = zend_try_array_init(arrayArg);
if (!arrayArg) { if (!arrayArg) {
return; RETURN_THROWS();
} }
res = estrndup(arg, arglen); res = estrndup(arg, arglen);

View file

@ -433,7 +433,7 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS)
} }
if ((bucket = (php_stream_bucket *)zend_fetch_resource_ex(pzbucket, PHP_STREAM_BUCKET_RES_NAME, le_bucket)) == NULL) { if ((bucket = (php_stream_bucket *)zend_fetch_resource_ex(pzbucket, PHP_STREAM_BUCKET_RES_NAME, le_bucket)) == NULL) {
return; RETURN_THROWS();
} }
if (NULL != (pzdata = zend_hash_str_find(Z_OBJPROP_P(zobject), "data", sizeof("data")-1)) && Z_TYPE_P(pzdata) == IS_STRING) { if (NULL != (pzdata = zend_hash_str_find(Z_OBJPROP_P(zobject), "data", sizeof("data")-1)) && Z_TYPE_P(pzdata) == IS_STRING) {

View file

@ -1135,7 +1135,7 @@ PHP_FUNCTION(serialize)
if (EG(exception)) { if (EG(exception)) {
smart_str_free(&buf); smart_str_free(&buf);
return; RETURN_THROWS();
} }
if (buf.s) { if (buf.s) {

View file

@ -1352,13 +1352,13 @@ PHP_FUNCTION(xml_parse_into_struct)
if (info) { if (info) {
info = zend_try_array_init(info); info = zend_try_array_init(info);
if (!info) { if (!info) {
return; RETURN_THROWS();
} }
} }
xdata = zend_try_array_init(xdata); xdata = zend_try_array_init(xdata);
if (!xdata) { if (!xdata) {
return; RETURN_THROWS();
} }
ZVAL_COPY_VALUE(&parser->data, xdata); ZVAL_COPY_VALUE(&parser->data, xdata);