Skip to content

Commit 9493893

Browse files
kocsismatenikic
authored andcommitted
Cleanup return values when parameter parsing is unsuccessful
1 parent 969e7a3 commit 9493893

File tree

27 files changed

+60
-78
lines changed

27 files changed

+60
-78
lines changed

ext/com_dotnet/com_com.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ PHP_FUNCTION(com_message_pump)
792792
DWORD result;
793793

794794
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &timeoutms) == FAILURE)
795-
RETURN_FALSE;
795+
return;
796796

797797
php_com_initialize();
798798
result = MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD)timeoutms, QS_ALLINPUT);

ext/curl/curl_file.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ static void curlfile_get_property(char *name, size_t name_len, INTERNAL_FUNCTION
7373
{
7474
zval *res, rv;
7575

76-
if (zend_parse_parameters_none() == FAILURE) {
77-
return;
78-
}
76+
ZEND_PARSE_PARAMETERS_NONE();
7977
res = zend_read_property(curl_CURLFile_class, ZEND_THIS, name, name_len, 1, &rv);
8078
ZVAL_COPY_DEREF(return_value, res);
8179
}

ext/curl/multi.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ PHP_FUNCTION(curl_multi_init)
5353
{
5454
php_curlm *mh;
5555

56-
if (zend_parse_parameters_none() == FAILURE) {
57-
return;
58-
}
56+
ZEND_PARSE_PARAMETERS_NONE();
5957

6058
mh = ecalloc(1, sizeof(php_curlm));
6159
mh->multi = curl_multi_init();

ext/curl/share.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ PHP_FUNCTION(curl_share_init)
3636
{
3737
php_curlsh *sh;
3838

39-
if (zend_parse_parameters_none() == FAILURE) {
40-
return;
41-
}
39+
ZEND_PARSE_PARAMETERS_NONE();
4240

4341
sh = ecalloc(1, sizeof(php_curlsh));
4442

ext/date/php_date.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,9 +1424,7 @@ PHP_FUNCTION(gmstrftime)
14241424
Return current UNIX timestamp */
14251425
PHP_FUNCTION(time)
14261426
{
1427-
if (zend_parse_parameters_none() == FAILURE) {
1428-
return;
1429-
}
1427+
ZEND_PARSE_PARAMETERS_NONE();
14301428

14311429
RETURN_LONG((zend_long)php_time());
14321430
}
@@ -4321,9 +4319,7 @@ PHP_METHOD(DatePeriod, getStartDate)
43214319
php_period_obj *dpobj;
43224320
php_date_obj *dateobj;
43234321

4324-
if (zend_parse_parameters_none() == FAILURE) {
4325-
return;
4326-
}
4322+
ZEND_PARSE_PARAMETERS_NONE();
43274323

43284324
dpobj = Z_PHPPERIOD_P(ZEND_THIS);
43294325

@@ -4348,9 +4344,7 @@ PHP_METHOD(DatePeriod, getEndDate)
43484344
php_period_obj *dpobj;
43494345
php_date_obj *dateobj;
43504346

4351-
if (zend_parse_parameters_none() == FAILURE) {
4352-
return;
4353-
}
4347+
ZEND_PARSE_PARAMETERS_NONE();
43544348

43554349
dpobj = Z_PHPPERIOD_P(ZEND_THIS);
43564350

@@ -4379,9 +4373,7 @@ PHP_METHOD(DatePeriod, getDateInterval)
43794373
php_period_obj *dpobj;
43804374
php_interval_obj *diobj;
43814375

4382-
if (zend_parse_parameters_none() == FAILURE) {
4383-
return;
4384-
}
4376+
ZEND_PARSE_PARAMETERS_NONE();
43854377

43864378
dpobj = Z_PHPPERIOD_P(ZEND_THIS);
43874379

@@ -4399,9 +4391,7 @@ PHP_METHOD(DatePeriod, getRecurrences)
43994391
{
44004392
php_period_obj *dpobj;
44014393

4402-
if (zend_parse_parameters_none() == FAILURE) {
4403-
return;
4404-
}
4394+
ZEND_PARSE_PARAMETERS_NONE();
44054395

44064396
dpobj = Z_PHPPERIOD_P(ZEND_THIS);
44074397

@@ -4546,9 +4536,7 @@ PHP_FUNCTION(date_default_timezone_set)
45464536
PHP_FUNCTION(date_default_timezone_get)
45474537
{
45484538
timelib_tzinfo *default_tz;
4549-
if (zend_parse_parameters_none() == FAILURE) {
4550-
return;
4551-
}
4539+
ZEND_PARSE_PARAMETERS_NONE();
45524540

45534541
default_tz = get_timezone_info();
45544542
RETVAL_STRING(default_tz->name);

ext/dba/dba.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ PHP_FUNCTION(dba_key_split)
10481048
}
10491049
}
10501050
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &key, &key_len) == FAILURE) {
1051-
RETURN_BOOL(0);
1051+
return;
10521052
}
10531053
array_init(return_value);
10541054
if (key[0] == '[' && (name = strchr(key, ']')) != NULL) {
@@ -1204,7 +1204,7 @@ PHP_FUNCTION(dba_handlers)
12041204
zend_bool full_info = 0;
12051205

12061206
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &full_info) == FAILURE) {
1207-
RETURN_FALSE;
1207+
return;
12081208
}
12091209

12101210
array_init(return_value);
@@ -1231,7 +1231,7 @@ PHP_FUNCTION(dba_list)
12311231
dba_info *info;
12321232

12331233
if (zend_parse_parameters_none() == FAILURE) {
1234-
RETURN_FALSE;
1234+
return;
12351235
}
12361236

12371237
array_init(return_value);

ext/fileinfo/fileinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ PHP_FUNCTION(finfo_open)
243243
zend_error_handling zeh;
244244

245245
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lp", &options, &file, &file_len) == FAILURE) {
246-
RETURN_FALSE;
246+
return;
247247
}
248248

249249
if (object) {

ext/filter/filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ PHP_FUNCTION(filter_has_var)
531531
zval *array_ptr = NULL;
532532

533533
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lS", &arg, &var) == FAILURE) {
534-
RETURN_FALSE;
534+
return;
535535
}
536536

537537
array_ptr = php_filter_get_storage(arg);

ext/hash/hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ PHP_FUNCTION(hash_init)
353353
php_hashcontext_object *hash;
354354

355355
if (zend_parse_parameters(argc, "S|lS", &algo, &options, &key) == FAILURE) {
356-
RETURN_NULL();
356+
return;
357357
}
358358

359359
ops = php_hash_fetch_ops(ZSTR_VAL(algo), ZSTR_LEN(algo));

ext/imap/php_imap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,7 +2119,7 @@ PHP_FUNCTION(imap_savebody)
21192119
zend_long msgno, flags = 0;
21202120

21212121
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "rzl|Sl", &stream, &out, &msgno, &section, &flags)) {
2122-
RETURN_FALSE;
2122+
return;
21232123
}
21242124

21252125
if ((imap_ptr = (pils *)zend_fetch_resource(Z_RES_P(stream), "imap", le_imap)) == NULL) {
@@ -4420,7 +4420,7 @@ PHP_FUNCTION(imap_timeout)
44204420
int timeout_type;
44214421

44224422
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &ttype, &timeout) == FAILURE) {
4423-
RETURN_FALSE;
4423+
return;
44244424
}
44254425

44264426
if (timeout == -1) {

ext/ldap/ldap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3420,7 +3420,7 @@ PHP_FUNCTION(ldap_parse_exop)
34203420
int rc, myargcount = ZEND_NUM_ARGS();
34213421

34223422
if (zend_parse_parameters(myargcount, "rr|zz", &link, &result, &retdata, &retoid) != SUCCESS) {
3423-
WRONG_PARAM_COUNT;
3423+
return;
34243424
}
34253425

34263426
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
@@ -4316,7 +4316,7 @@ PHP_FUNCTION(ldap_exop_whoami)
43164316
int rc;
43174317

43184318
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &link) == FAILURE) {
4319-
WRONG_PARAM_COUNT;
4319+
return;
43204320
}
43214321

43224322
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
@@ -4354,7 +4354,7 @@ PHP_FUNCTION(ldap_exop_refresh)
43544354
int rc;
43554355

43564356
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz", &link, &ldn.bv_val, &ldn.bv_len, &ttl) != SUCCESS) {
4357-
WRONG_PARAM_COUNT;
4357+
return;
43584358
}
43594359

43604360
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {

ext/opcache/zend_accelerator_module.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ static ZEND_FUNCTION(opcache_get_configuration)
717717
zval directives, version, blacklist;
718718

719719
if (zend_parse_parameters_none() == FAILURE) {
720-
RETURN_FALSE;
720+
return;
721721
}
722722

723723
if (!validate_api_restriction()) {
@@ -809,7 +809,7 @@ static ZEND_FUNCTION(opcache_get_configuration)
809809
static ZEND_FUNCTION(opcache_reset)
810810
{
811811
if (zend_parse_parameters_none() == FAILURE) {
812-
RETURN_FALSE;
812+
return;
813813
}
814814

815815
if (!validate_api_restriction()) {

ext/openssl/openssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4908,7 +4908,7 @@ PHP_FUNCTION(openssl_pkey_derive)
49084908
zend_string *result;
49094909

49104910
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|l", &peer_pub_key, &priv_key, &key_len) == FAILURE) {
4911-
RETURN_FALSE;
4911+
return;
49124912
}
49134913
if (key_len < 0) {
49144914
php_error_docref(NULL, E_WARNING, "keylen < 0, assuming NULL");

ext/pcntl/pcntl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ PHP_FUNCTION(pcntl_setpriority)
12791279
zend_long pri;
12801280

12811281
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|ll", &pri, &pid, &who) == FAILURE) {
1282-
RETURN_FALSE;
1282+
return;
12831283
}
12841284

12851285
if (setpriority(who, pid, pri)) {

ext/pdo/pdo_dbh.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,12 +1051,12 @@ static PHP_METHOD(PDO, query)
10511051
/* Return a meaningful error when no parameters were passed */
10521052
if (!ZEND_NUM_ARGS()) {
10531053
zend_parse_parameters(0, "z|z", NULL, NULL);
1054-
RETURN_FALSE;
1054+
return;
10551055
}
10561056

10571057
if (FAILURE == zend_parse_parameters(1, "s", &statement,
10581058
&statement_len)) {
1059-
RETURN_FALSE;
1059+
return;
10601060
}
10611061

10621062
PDO_DBH_CLEAR_ERR();

ext/pdo/pdo_stmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,7 @@ static PHP_METHOD(PDOStatement, bindValue)
15781578
"lz|l", &param.paramno, &parameter, &param_type)) {
15791579
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|l", &param.name,
15801580
&parameter, &param_type)) {
1581-
RETURN_FALSE;
1581+
return;
15821582
}
15831583
}
15841584

ext/pdo_pgsql/pgsql_driver.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ static PHP_METHOD(PDO, pgsqlLOBOpen)
956956

957957
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|s",
958958
&oidstr, &oidstrlen, &modestr, &modestrlen)) {
959-
RETURN_FALSE;
959+
return;
960960
}
961961

962962
oid = (Oid)strtoul(oidstr, &end_ptr, 10);
@@ -1003,7 +1003,7 @@ static PHP_METHOD(PDO, pgsqlLOBUnlink)
10031003

10041004
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s",
10051005
&oidstr, &oidlen)) {
1006-
RETURN_FALSE;
1006+
return;
10071007
}
10081008

10091009
oid = (Oid)strtoul(oidstr, &end_ptr, 10);
@@ -1039,7 +1039,7 @@ static PHP_METHOD(PDO, pgsqlGetNotify)
10391039

10401040
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|ll",
10411041
&result_type, &ms_timeout)) {
1042-
RETURN_FALSE;
1042+
return;
10431043
}
10441044

10451045
dbh = Z_PDO_DBH_P(ZEND_THIS);

ext/pgsql/pgsql.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2944,7 +2944,7 @@ PHP_FUNCTION(pg_fetch_all_columns)
29442944
size_t num_fields;
29452945

29462946
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &result, &colno) == FAILURE) {
2947-
RETURN_FALSE;
2947+
return;
29482948
}
29492949

29502950
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {

ext/phar/phar_object.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,7 @@ PHP_METHOD(Phar, unlinkArchive)
13161316
phar_archive_data *phar;
13171317

13181318
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
1319-
RETURN_FALSE;
1319+
return;
13201320
}
13211321

13221322
if (!fname_len) {
@@ -1736,7 +1736,7 @@ PHP_METHOD(Phar, buildFromDirectory)
17361736
}
17371737

17381738
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|s", &dir, &dir_len, &regex, &regex_len) == FAILURE) {
1739-
RETURN_FALSE;
1739+
return;
17401740
}
17411741

17421742
if (ZEND_SIZE_T_UINT_OVFL(dir_len)) {
@@ -1872,7 +1872,7 @@ PHP_METHOD(Phar, buildFromIterator)
18721872
}
18731873

18741874
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|s", &obj, zend_ce_traversable, &base, &base_len) == FAILURE) {
1875-
RETURN_FALSE;
1875+
return;
18761876
}
18771877

18781878
if (ZEND_SIZE_T_UINT_OVFL(base_len)) {
@@ -1921,7 +1921,7 @@ PHP_METHOD(Phar, count)
19211921
PHAR_ARCHIVE_OBJECT();
19221922

19231923
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &mode) == FAILURE) {
1924-
RETURN_FALSE;
1924+
return;
19251925
}
19261926

19271927
RETURN_LONG(zend_hash_num_elements(&phar_obj->archive->manifest));
@@ -1938,7 +1938,7 @@ PHP_METHOD(Phar, isFileFormat)
19381938
PHAR_ARCHIVE_OBJECT();
19391939

19401940
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &type) == FAILURE) {
1941-
RETURN_FALSE;
1941+
return;
19421942
}
19431943

19441944
switch (type) {
@@ -2641,7 +2641,7 @@ PHP_METHOD(Phar, delete)
26412641
}
26422642

26432643
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
2644-
RETURN_FALSE;
2644+
return;
26452645
}
26462646

26472647
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
@@ -2985,7 +2985,7 @@ PHP_METHOD(Phar, setDefaultStub)
29852985
}
29862986

29872987
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
2988-
RETURN_FALSE;
2988+
return;
29892989
}
29902990

29912991
if (ZEND_NUM_ARGS() > 0 && (phar_obj->archive->is_tar || phar_obj->archive->is_zip)) {

ext/readline/readline.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ PHP_FUNCTION(readline)
160160
char *result;
161161

162162
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|s!", &prompt, &prompt_len)) {
163-
RETURN_FALSE;
163+
return;
164164
}
165165

166166
result = readline(prompt);
@@ -522,7 +522,7 @@ PHP_FUNCTION(readline_completion_function)
522522
zval *arg;
523523

524524
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg)) {
525-
RETURN_FALSE;
525+
return;
526526
}
527527

528528
if (!zend_is_callable(arg, 0, NULL)) {

0 commit comments

Comments
 (0)