Skip to content

Commit e1b5731

Browse files
committed
Use RETURN_THROWS() during ZPP in main, sapi, win32, and Zend
1 parent 31cf9a7 commit e1b5731

File tree

15 files changed

+100
-100
lines changed

15 files changed

+100
-100
lines changed

Zend/zend_builtin_functions.c

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ int zend_startup_builtin_functions(void) /* {{{ */
191191
ZEND_FUNCTION(zend_version)
192192
{
193193
if (zend_parse_parameters_none() == FAILURE) {
194-
return;
194+
RETURN_THROWS();
195195
}
196196

197197
RETURN_STRINGL(ZEND_VERSION, sizeof(ZEND_VERSION)-1);
@@ -204,7 +204,7 @@ ZEND_FUNCTION(zend_version)
204204
ZEND_FUNCTION(gc_mem_caches)
205205
{
206206
if (zend_parse_parameters_none() == FAILURE) {
207-
return;
207+
RETURN_THROWS();
208208
}
209209

210210
RETURN_LONG(zend_mm_gc(zend_mm_get_heap()));
@@ -217,7 +217,7 @@ ZEND_FUNCTION(gc_mem_caches)
217217
ZEND_FUNCTION(gc_collect_cycles)
218218
{
219219
if (zend_parse_parameters_none() == FAILURE) {
220-
return;
220+
RETURN_THROWS();
221221
}
222222

223223
RETURN_LONG(gc_collect_cycles());
@@ -229,7 +229,7 @@ ZEND_FUNCTION(gc_collect_cycles)
229229
ZEND_FUNCTION(gc_enabled)
230230
{
231231
if (zend_parse_parameters_none() == FAILURE) {
232-
return;
232+
RETURN_THROWS();
233233
}
234234

235235
RETURN_BOOL(gc_enabled());
@@ -243,7 +243,7 @@ ZEND_FUNCTION(gc_enable)
243243
zend_string *key;
244244

245245
if (zend_parse_parameters_none() == FAILURE) {
246-
return;
246+
RETURN_THROWS();
247247
}
248248

249249
key = zend_string_init("zend.enable_gc", sizeof("zend.enable_gc")-1, 0);
@@ -259,7 +259,7 @@ ZEND_FUNCTION(gc_disable)
259259
zend_string *key;
260260

261261
if (zend_parse_parameters_none() == FAILURE) {
262-
return;
262+
RETURN_THROWS();
263263
}
264264

265265
key = zend_string_init("zend.enable_gc", sizeof("zend.enable_gc")-1, 0);
@@ -275,7 +275,7 @@ ZEND_FUNCTION(gc_status)
275275
zend_gc_status status;
276276

277277
if (zend_parse_parameters_none() == FAILURE) {
278-
return;
278+
RETURN_THROWS();
279279
}
280280

281281
zend_gc_get_status(&status);
@@ -296,7 +296,7 @@ ZEND_FUNCTION(func_num_args)
296296
zend_execute_data *ex = EX(prev_execute_data);
297297

298298
if (zend_parse_parameters_none() == FAILURE) {
299-
return;
299+
RETURN_THROWS();
300300
}
301301

302302
if (ZEND_CALL_INFO(ex) & ZEND_CALL_CODE) {
@@ -322,7 +322,7 @@ ZEND_FUNCTION(func_get_arg)
322322
zend_execute_data *ex;
323323

324324
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &requested_offset) == FAILURE) {
325-
return;
325+
RETURN_THROWS();
326326
}
327327

328328
if (requested_offset < 0) {
@@ -735,7 +735,7 @@ ZEND_FUNCTION(get_class)
735735
zval *obj = NULL;
736736

737737
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|o", &obj) == FAILURE) {
738-
return;
738+
RETURN_THROWS();
739739
}
740740

741741
if (!obj) {
@@ -760,7 +760,7 @@ ZEND_FUNCTION(get_called_class)
760760
zend_class_entry *called_scope;
761761

762762
if (zend_parse_parameters_none() == FAILURE) {
763-
return;
763+
RETURN_THROWS();
764764
}
765765

766766
called_scope = zend_get_called_scope(execute_data);
@@ -784,7 +784,7 @@ ZEND_FUNCTION(get_parent_class)
784784
zend_class_entry *ce = NULL;
785785

786786
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &arg) == FAILURE) {
787-
return;
787+
RETURN_THROWS();
788788
}
789789

790790
if (!ZEND_NUM_ARGS()) {
@@ -933,7 +933,7 @@ ZEND_FUNCTION(get_class_vars)
933933
zend_class_entry *ce, *scope;
934934

935935
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &class_name) == FAILURE) {
936-
return;
936+
RETURN_THROWS();
937937
}
938938

939939
ce = zend_lookup_class(class_name);
@@ -1079,7 +1079,7 @@ ZEND_FUNCTION(get_class_methods)
10791079
zend_string *key;
10801080

10811081
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &klass) == FAILURE) {
1082-
return;
1082+
RETURN_THROWS();
10831083
}
10841084

10851085
if (Z_TYPE_P(klass) == IS_OBJECT) {
@@ -1185,7 +1185,7 @@ ZEND_FUNCTION(property_exists)
11851185
zend_property_info *property_info;
11861186

11871187
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zS", &object, &property) == FAILURE) {
1188-
return;
1188+
RETURN_THROWS();
11891189
}
11901190

11911191
if (property == NULL) {
@@ -1322,7 +1322,7 @@ ZEND_FUNCTION(class_alias)
13221322
zend_bool autoload = 1;
13231323

13241324
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ss|b", &class_name, &alias_name, &alias_name_len, &autoload) == FAILURE) {
1325-
return;
1325+
RETURN_THROWS();
13261326
}
13271327

13281328
ce = zend_lookup_class_ex(class_name, NULL, !autoload ? ZEND_FETCH_CLASS_NO_AUTOLOAD : 0);
@@ -1353,7 +1353,7 @@ ZEND_FUNCTION(get_included_files)
13531353
zend_string *entry;
13541354

13551355
if (zend_parse_parameters_none() == FAILURE) {
1356-
return;
1356+
RETURN_THROWS();
13571357
}
13581358

13591359
array_init(return_value);
@@ -1374,7 +1374,7 @@ ZEND_FUNCTION(trigger_error)
13741374
size_t message_len;
13751375

13761376
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &message, &message_len, &error_type) == FAILURE) {
1377-
return;
1377+
RETURN_THROWS();
13781378
}
13791379

13801380
switch (error_type) {
@@ -1402,7 +1402,7 @@ ZEND_FUNCTION(set_error_handler)
14021402
zend_long error_type = E_ALL;
14031403

14041404
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &error_handler, &error_type) == FAILURE) {
1405-
return;
1405+
RETURN_THROWS();
14061406
}
14071407

14081408
if (Z_TYPE_P(error_handler) != IS_NULL) { /* NULL == unset */
@@ -1437,7 +1437,7 @@ ZEND_FUNCTION(set_error_handler)
14371437
ZEND_FUNCTION(restore_error_handler)
14381438
{
14391439
if (zend_parse_parameters_none() == FAILURE) {
1440-
return;
1440+
RETURN_THROWS();
14411441
}
14421442

14431443
if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
@@ -1469,7 +1469,7 @@ ZEND_FUNCTION(set_exception_handler)
14691469
zval *exception_handler;
14701470

14711471
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &exception_handler) == FAILURE) {
1472-
return;
1472+
RETURN_THROWS();
14731473
}
14741474

14751475
if (Z_TYPE_P(exception_handler) != IS_NULL) { /* NULL == unset */
@@ -1502,7 +1502,7 @@ ZEND_FUNCTION(set_exception_handler)
15021502
ZEND_FUNCTION(restore_exception_handler)
15031503
{
15041504
if (zend_parse_parameters_none() == FAILURE) {
1505-
return;
1505+
RETURN_THROWS();
15061506
}
15071507

15081508
if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
@@ -1535,7 +1535,7 @@ static inline void get_declared_class_impl(INTERNAL_FUNCTION_PARAMETERS, int fla
15351535
zend_class_entry *ce;
15361536

15371537
if (zend_parse_parameters_none() == FAILURE) {
1538-
return;
1538+
RETURN_THROWS();
15391539
}
15401540

15411541
array_init(return_value);
@@ -1585,7 +1585,7 @@ ZEND_FUNCTION(get_defined_functions)
15851585
char *disable_functions = NULL;
15861586

15871587
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &exclude_disabled) == FAILURE) {
1588-
return;
1588+
RETURN_THROWS();
15891589
}
15901590

15911591
array_init(&internal);
@@ -1654,7 +1654,7 @@ ZEND_FUNCTION(get_resource_type)
16541654
zval *z_resource_type;
16551655

16561656
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_resource_type) == FAILURE) {
1657-
return;
1657+
RETURN_THROWS();
16581658
}
16591659

16601660
resource_type = zend_rsrc_list_get_rsrc_type(Z_RES_P(z_resource_type));
@@ -1676,7 +1676,7 @@ ZEND_FUNCTION(get_resources)
16761676
zval *val;
16771677

16781678
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &type) == FAILURE) {
1679-
return;
1679+
RETURN_THROWS();
16801680
}
16811681

16821682
if (!type) {
@@ -1729,7 +1729,7 @@ ZEND_FUNCTION(get_loaded_extensions)
17291729
zend_bool zendext = 0;
17301730

17311731
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &zendext) == FAILURE) {
1732-
return;
1732+
RETURN_THROWS();
17331733
}
17341734

17351735
array_init(return_value);
@@ -1753,7 +1753,7 @@ ZEND_FUNCTION(get_defined_constants)
17531753
zend_bool categorize = 0;
17541754

17551755
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &categorize) == FAILURE) {
1756-
return;
1756+
RETURN_THROWS();
17571757
}
17581758

17591759
array_init(return_value);
@@ -1939,7 +1939,7 @@ ZEND_FUNCTION(debug_print_backtrace)
19391939
zend_long limit = 0;
19401940

19411941
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &options, &limit) == FAILURE) {
1942-
return;
1942+
RETURN_THROWS();
19431943
}
19441944

19451945
ZVAL_UNDEF(&arg_array);
@@ -2327,7 +2327,7 @@ ZEND_FUNCTION(debug_backtrace)
23272327
zend_long limit = 0;
23282328

23292329
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &options, &limit) == FAILURE) {
2330-
return;
2330+
RETURN_THROWS();
23312331
}
23322332

23332333
zend_fetch_debug_backtrace(return_value, 1, options, limit);
@@ -2342,7 +2342,7 @@ ZEND_FUNCTION(extension_loaded)
23422342
zend_string *lcname;
23432343

23442344
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &extension_name) == FAILURE) {
2345-
return;
2345+
RETURN_THROWS();
23462346
}
23472347

23482348
lcname = zend_string_tolower(extension_name);
@@ -2366,7 +2366,7 @@ ZEND_FUNCTION(get_extension_funcs)
23662366
zend_function *zif;
23672367

23682368
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &extension_name) == FAILURE) {
2369-
return;
2369+
RETURN_THROWS();
23702370
}
23712371
if (strncasecmp(ZSTR_VAL(extension_name), "zend", sizeof("zend"))) {
23722372
lcname = zend_string_tolower(extension_name);

Zend/zend_closures.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ ZEND_METHOD(Closure, call)
124124
fci.params = NULL;
125125

126126
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o*", &newthis, &fci.params, &fci.param_count) == FAILURE) {
127-
return;
127+
RETURN_THROWS();
128128
}
129129

130130
closure = (zend_closure *) Z_OBJ_P(ZEND_THIS);
@@ -333,7 +333,7 @@ ZEND_METHOD(Closure, fromCallable)
333333
char *error = NULL;
334334

335335
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callable) == FAILURE) {
336-
return;
336+
RETURN_THROWS();
337337
}
338338

339339
if (Z_TYPE_P(callable) == IS_OBJECT && instanceof_function(Z_OBJCE_P(callable), zend_ce_closure)) {

Zend/zend_generators.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ ZEND_METHOD(Generator, rewind)
896896
zend_generator *generator;
897897

898898
if (zend_parse_parameters_none() == FAILURE) {
899-
return;
899+
RETURN_THROWS();
900900
}
901901

902902
generator = (zend_generator *) Z_OBJ_P(ZEND_THIS);
@@ -912,7 +912,7 @@ ZEND_METHOD(Generator, valid)
912912
zend_generator *generator;
913913

914914
if (zend_parse_parameters_none() == FAILURE) {
915-
return;
915+
RETURN_THROWS();
916916
}
917917

918918
generator = (zend_generator *) Z_OBJ_P(ZEND_THIS);
@@ -932,7 +932,7 @@ ZEND_METHOD(Generator, current)
932932
zend_generator *generator, *root;
933933

934934
if (zend_parse_parameters_none() == FAILURE) {
935-
return;
935+
RETURN_THROWS();
936936
}
937937

938938
generator = (zend_generator *) Z_OBJ_P(ZEND_THIS);
@@ -955,7 +955,7 @@ ZEND_METHOD(Generator, key)
955955
zend_generator *generator, *root;
956956

957957
if (zend_parse_parameters_none() == FAILURE) {
958-
return;
958+
RETURN_THROWS();
959959
}
960960

961961
generator = (zend_generator *) Z_OBJ_P(ZEND_THIS);
@@ -978,7 +978,7 @@ ZEND_METHOD(Generator, next)
978978
zend_generator *generator;
979979

980980
if (zend_parse_parameters_none() == FAILURE) {
981-
return;
981+
RETURN_THROWS();
982982
}
983983

984984
generator = (zend_generator *) Z_OBJ_P(ZEND_THIS);
@@ -1071,7 +1071,7 @@ ZEND_METHOD(Generator, getReturn)
10711071
zend_generator *generator;
10721072

10731073
if (zend_parse_parameters_none() == FAILURE) {
1074-
return;
1074+
RETURN_THROWS();
10751075
}
10761076

10771077
generator = (zend_generator *) Z_OBJ_P(ZEND_THIS);

main/SAPI.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ PHP_FUNCTION(header_register_callback)
116116
zval *callback_func;
117117

118118
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callback_func) == FAILURE) {
119-
return;
119+
RETURN_THROWS();
120120
}
121121

122122
if (!zend_is_callable(callback_func, 0, NULL)) {

main/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,7 @@ PHP_FUNCTION(set_time_limit)
14971497
zend_string *key;
14981498

14991499
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &new_timeout) == FAILURE) {
1500-
return;
1500+
RETURN_THROWS();
15011501
}
15021502

15031503
new_timeout_strlen = (int)zend_spprintf(&new_timeout_str, 0, ZEND_LONG_FMT, new_timeout);

0 commit comments

Comments
 (0)