From 76c45f35f55b50cfb4fc581d3358998b25e5531e Mon Sep 17 00:00:00 2001 From: =?utf8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Mon, 30 Dec 2019 18:09:40 +0100 Subject: [PATCH] Use RETURN_THROWS() during ZPP in bz2, calendar, com_dotnet extensions --- ext/bz2/bz2.c | 10 +++++----- ext/calendar/cal_unix.c | 4 ++-- ext/calendar/calendar.c | 29 ++++++++++++++--------------- ext/calendar/easter.c | 2 +- ext/com_dotnet/com_com.c | 12 ++++++------ ext/com_dotnet/com_dotnet.c | 2 +- ext/com_dotnet/com_persist.c | 10 +++++----- ext/com_dotnet/com_variant.c | 14 +++++++------- 8 files changed, 41 insertions(+), 42 deletions(-) diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c index 7b7fb3a227..b32044e17e 100644 --- a/ext/bz2/bz2.c +++ b/ext/bz2/bz2.c @@ -333,7 +333,7 @@ static PHP_FUNCTION(bzread) zend_string *data; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &bz, &len)) { - return; + RETURN_THROWS(); } php_stream_from_zval(stream, bz); @@ -363,7 +363,7 @@ static PHP_FUNCTION(bzopen) php_stream *stream = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs", &file, &mode, &mode_len) == FAILURE) { - return; + RETURN_THROWS(); } if (mode_len != 1 || (mode[0] != 'r' && mode[0] != 'w')) { @@ -482,7 +482,7 @@ static PHP_FUNCTION(bzcompress) unsigned int dest_len; /* Length of the destination buffer */ if (zend_parse_parameters(argc, "s|ll", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) { - return; + RETURN_THROWS(); } /* Assign them to easy to use variables, dest_len is initially the length of the data @@ -534,7 +534,7 @@ static PHP_FUNCTION(bzdecompress) bz_stream bzs; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &source, &source_len, &small)) { - return; + RETURN_THROWS(); } bzs.bzalloc = NULL; @@ -601,7 +601,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt) struct php_bz2_stream_data_t *self; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &bzp) == FAILURE) { - return; + RETURN_THROWS(); } php_stream_from_zval(stream, bzp); diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c index 78e6952268..c850bc1d5b 100644 --- a/ext/calendar/cal_unix.c +++ b/ext/calendar/cal_unix.c @@ -29,7 +29,7 @@ PHP_FUNCTION(unixtojd) struct tm *ta, tmbuf; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &ts) == FAILURE) { - return; + RETURN_THROWS(); } if (!ts) { @@ -54,7 +54,7 @@ PHP_FUNCTION(jdtounix) zend_long uday; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &uday) == FAILURE) { - return; + RETURN_THROWS(); } uday -= 2440588 /* J.D. of 1.1.1970 */; diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c index 9acdbc00f9..570e004533 100644 --- a/ext/calendar/calendar.c +++ b/ext/calendar/calendar.c @@ -198,9 +198,8 @@ PHP_FUNCTION(cal_info) { zend_long cal = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &cal) == FAILURE) { - return; + RETURN_THROWS(); } if (cal == -1) { @@ -236,7 +235,7 @@ PHP_FUNCTION(cal_days_in_month) zend_long sdn_start, sdn_next; if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &cal, &month, &year) == FAILURE) { - return; + RETURN_THROWS(); } if (cal < 0 || cal >= CAL_NUM_CALS) { @@ -282,7 +281,7 @@ PHP_FUNCTION(cal_to_jd) zend_long cal, month, day, year; if (zend_parse_parameters(ZEND_NUM_ARGS(), "llll", &cal, &month, &day, &year) != SUCCESS) { - return; + RETURN_THROWS(); } if (cal < 0 || cal >= CAL_NUM_CALS) { @@ -303,7 +302,7 @@ PHP_FUNCTION(cal_from_jd) const struct cal_entry_t *calendar; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &jd, &cal) == FAILURE) { - return; + RETURN_THROWS(); } if (cal < 0 || cal >= CAL_NUM_CALS) { @@ -354,7 +353,7 @@ PHP_FUNCTION(jdtogregorian) int year, month, day; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &julday) == FAILURE) { - return; + RETURN_THROWS(); } SdnToGregorian(julday, &year, &month, &day); @@ -370,7 +369,7 @@ PHP_FUNCTION(gregoriantojd) zend_long year, month, day; if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) { - return; + RETURN_THROWS(); } RETURN_LONG(GregorianToSdn(year, month, day)); @@ -385,7 +384,7 @@ PHP_FUNCTION(jdtojulian) int year, month, day; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &julday) == FAILURE) { - return; + RETURN_THROWS(); } SdnToJulian(julday, &year, &month, &day); @@ -401,7 +400,7 @@ PHP_FUNCTION(juliantojd) zend_long year, month, day; if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) { - return; + RETURN_THROWS(); } RETURN_LONG(JulianToSdn(year, month, day)); @@ -514,7 +513,7 @@ PHP_FUNCTION(jdtojewish) char *dayp, *yearp; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|bl", &julday, &heb, &fl) == FAILURE) { - return; + RETURN_THROWS(); } SdnToJewish(julday, &year, &month, &day); @@ -545,7 +544,7 @@ PHP_FUNCTION(jewishtojd) zend_long year, month, day; if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) { - return; + RETURN_THROWS(); } RETURN_LONG(JewishToSdn(year, month, day)); @@ -560,7 +559,7 @@ PHP_FUNCTION(jdtofrench) int year, month, day; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &julday) == FAILURE) { - return; + RETURN_THROWS(); } SdnToFrench(julday, &year, &month, &day); @@ -576,7 +575,7 @@ PHP_FUNCTION(frenchtojd) zend_long year, month, day; if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) { - return; + RETURN_THROWS(); } RETURN_LONG(FrenchToSdn(year, month, day)); @@ -592,7 +591,7 @@ PHP_FUNCTION(jddayofweek) const char *daynamel, *daynames; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &julday, &mode) == FAILURE) { - return; + RETURN_THROWS(); } day = DayOfWeek(julday); @@ -623,7 +622,7 @@ PHP_FUNCTION(jdmonthname) int month, day, year; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &julday, &mode) == FAILURE) { - return; + RETURN_THROWS(); } switch (mode) { diff --git a/ext/calendar/easter.c b/ext/calendar/easter.c index b6e3ee6d6d..4bb8c6e3b0 100644 --- a/ext/calendar/easter.c +++ b/ext/calendar/easter.c @@ -45,7 +45,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, zend_long gm) if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &year, &method) == FAILURE) { - return; + RETURN_THROWS(); } if (gm && (year<1970 || year>2037)) { /* out of range for timestamps */ diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index 526ccf7977..0ae3df5641 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -298,7 +298,7 @@ PHP_FUNCTION(com_get_active_object) php_com_initialize(); if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &module_name, &module_name_len, &code_page)) { - return; + RETURN_THROWS(); } module = php_com_string_to_olestring(module_name, module_name_len, (int)code_page); @@ -666,7 +666,7 @@ PHP_FUNCTION(com_create_guid) OLECHAR *guid_string; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } php_com_initialize(); @@ -699,7 +699,7 @@ PHP_FUNCTION(com_event_sink) if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Oo|z/", &object, php_com_variant_class_entry, &sinkobject, &sink)) { - return; + RETURN_THROWS(); } php_com_initialize(); @@ -760,7 +760,7 @@ PHP_FUNCTION(com_print_typeinfo) if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "z/|s!b", &arg1, &ifacename, &ifacelen, &wantsink)) { - return; + RETURN_THROWS(); } php_com_initialize(); @@ -792,7 +792,7 @@ PHP_FUNCTION(com_message_pump) DWORD result; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &timeoutms) == FAILURE) - return; + RETURN_THROWS(); php_com_initialize(); result = MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD)timeoutms, QS_ALLINPUT); @@ -823,7 +823,7 @@ PHP_FUNCTION(com_load_typelib) int cached = 0; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &name, &namelen, &cs)) { - return; + RETURN_THROWS(); } if (!cs) { diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c index 40fb6479b1..ad35d91636 100644 --- a/ext/com_dotnet/com_dotnet.c +++ b/ext/com_dotnet/com_dotnet.c @@ -241,7 +241,7 @@ PHP_FUNCTION(com_dotnet_create_instance) &assembly_name, &assembly_name_len, &datatype_name, &datatype_name_len, &cp)) { - return; + RETURN_THROWS(); } cp_it = php_win32_cp_get_by_id((DWORD)cp); diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c index dc320c966c..9710972a86 100644 --- a/ext/com_dotnet/com_persist.c +++ b/ext/com_dotnet/com_persist.c @@ -380,7 +380,7 @@ CPH_METHOD(SaveToFile) if (helper->ipf) { if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p!|b", &filename, &filename_len, &remember)) { - return; + RETURN_THROWS(); } if (filename) { @@ -443,7 +443,7 @@ CPH_METHOD(LoadFromFile) if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p|l", &filename, &filename_len, &flags)) { - return; + RETURN_THROWS(); } if (!(fullpath = expand_filepath(filename, NULL))) { @@ -538,7 +538,7 @@ CPH_METHOD(LoadFromStream) CPH_FETCH(); if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zstm)) { - return; + RETURN_THROWS(); } php_stream_from_zval_no_verify(stream, zstm); @@ -599,7 +599,7 @@ CPH_METHOD(SaveToStream) CPH_NO_OBJ(); if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zstm)) { - return; + RETURN_THROWS(); } php_stream_from_zval_no_verify(stream, zstm); @@ -646,7 +646,7 @@ CPH_METHOD(__construct) if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|O!", &zobj, php_com_variant_class_entry)) { - return; + RETURN_THROWS(); } if (!zobj) { diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index e74739135a..2a545e1221 100644 --- a/ext/com_dotnet/com_variant.c +++ b/ext/com_dotnet/com_variant.c @@ -450,7 +450,7 @@ PHP_FUNCTION(com_variant_create_instance) if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "z!|ll", &zvalue, &vt, &codepage)) { - return; + RETURN_THROWS(); } php_com_initialize(); @@ -511,7 +511,7 @@ PHP_FUNCTION(variant_set) if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Oz!", &zobj, php_com_variant_class_entry, &zvalue)) { - return; + RETURN_THROWS(); } obj = CDNO_FETCH(zobj); @@ -955,7 +955,7 @@ PHP_FUNCTION(variant_date_to_timestamp) if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zleft, php_com_variant_class_entry)) { - return; + RETURN_THROWS(); } obj = CDNO_FETCH(zleft); @@ -994,7 +994,7 @@ PHP_FUNCTION(variant_date_from_timestamp) if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "l", ×tamp)) { - return; + RETURN_THROWS(); } if (timestamp < 0) { @@ -1040,7 +1040,7 @@ PHP_FUNCTION(variant_get_type) if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zobj, php_com_variant_class_entry)) { - return; + RETURN_THROWS(); } obj = CDNO_FETCH(zobj); @@ -1059,7 +1059,7 @@ PHP_FUNCTION(variant_set_type) if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &zobj, php_com_variant_class_entry, &vt)) { - return; + RETURN_THROWS(); } obj = CDNO_FETCH(zobj); @@ -1095,7 +1095,7 @@ PHP_FUNCTION(variant_cast) if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &zobj, php_com_variant_class_entry, &vt)) { - return; + RETURN_THROWS(); } obj = CDNO_FETCH(zobj); -- 2.40.0