Skip to content

Commit 46540a0

Browse files
committed
Merge branch 'ext-date-zpp'
2 parents e16bc4b + bc9a113 commit 46540a0

File tree

1 file changed

+47
-36
lines changed

1 file changed

+47
-36
lines changed

ext/date/php_date.c

+47-36
Original file line numberDiff line numberDiff line change
@@ -3352,9 +3352,9 @@ PHP_METHOD(DateTime, modify)
33523352
zend_error_handling zeh;
33533353

33543354
object = ZEND_THIS;
3355-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &modify, &modify_len) == FAILURE) {
3356-
RETURN_THROWS();
3357-
}
3355+
ZEND_PARSE_PARAMETERS_START(1, 1)
3356+
Z_PARAM_STRING(modify, modify_len)
3357+
ZEND_PARSE_PARAMETERS_END();
33583358

33593359
zend_replace_error_handling(EH_THROW, date_ce_date_malformed_string_exception, &zeh);
33603360
if (!php_date_modify(object, modify, modify_len)) {
@@ -3377,9 +3377,9 @@ PHP_METHOD(DateTimeImmutable, modify)
33773377
zend_error_handling zeh;
33783378

33793379
object = ZEND_THIS;
3380-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &modify, &modify_len) == FAILURE) {
3381-
RETURN_THROWS();
3382-
}
3380+
ZEND_PARSE_PARAMETERS_START(1, 1)
3381+
Z_PARAM_STRING(modify, modify_len)
3382+
ZEND_PARSE_PARAMETERS_END();
33833383

33843384
date_clone_immutable(object, &new_object);
33853385

@@ -3437,9 +3437,9 @@ PHP_METHOD(DateTimeImmutable, add)
34373437
zval *object, *interval, new_object;
34383438

34393439
object = ZEND_THIS;
3440-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &interval, date_ce_interval) == FAILURE) {
3441-
RETURN_THROWS();
3442-
}
3440+
ZEND_PARSE_PARAMETERS_START(1, 1)
3441+
Z_PARAM_OBJECT_OF_CLASS(interval, date_ce_interval)
3442+
ZEND_PARSE_PARAMETERS_END();
34433443

34443444
date_clone_immutable(object, &new_object);
34453445
php_date_add(&new_object, interval, return_value);
@@ -3512,9 +3512,9 @@ PHP_METHOD(DateTimeImmutable, sub)
35123512
zend_error_handling zeh;
35133513

35143514
object = ZEND_THIS;
3515-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &interval, date_ce_interval) == FAILURE) {
3516-
RETURN_THROWS();
3517-
}
3515+
ZEND_PARSE_PARAMETERS_START(1, 1)
3516+
Z_PARAM_OBJECT_OF_CLASS(interval, date_ce_interval)
3517+
ZEND_PARSE_PARAMETERS_END();
35183518

35193519
date_clone_immutable(object, &new_object);
35203520

@@ -3621,9 +3621,9 @@ PHP_METHOD(DateTimeImmutable, setTimezone)
36213621
zval *timezone_object;
36223622

36233623
object = ZEND_THIS;
3624-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &timezone_object, date_ce_timezone) == FAILURE) {
3625-
RETURN_THROWS();
3626-
}
3624+
ZEND_PARSE_PARAMETERS_START(1, 1)
3625+
Z_PARAM_OBJECT_OF_CLASS(timezone_object, date_ce_timezone)
3626+
ZEND_PARSE_PARAMETERS_END();
36273627

36283628
date_clone_immutable(object, &new_object);
36293629
php_date_timezone_set(&new_object, timezone_object, return_value);
@@ -3702,9 +3702,13 @@ PHP_METHOD(DateTimeImmutable, setTime)
37023702
zend_long h, i, s = 0, ms = 0;
37033703

37043704
object = ZEND_THIS;
3705-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|ll", &h, &i, &s, &ms) == FAILURE) {
3706-
RETURN_THROWS();
3707-
}
3705+
ZEND_PARSE_PARAMETERS_START(2, 4)
3706+
Z_PARAM_LONG(h)
3707+
Z_PARAM_LONG(i)
3708+
Z_PARAM_OPTIONAL
3709+
Z_PARAM_LONG(s)
3710+
Z_PARAM_LONG(ms)
3711+
ZEND_PARSE_PARAMETERS_END();
37083712

37093713
date_clone_immutable(object, &new_object);
37103714
php_date_time_set(&new_object, h, i, s, ms, return_value);
@@ -3748,9 +3752,11 @@ PHP_METHOD(DateTimeImmutable, setDate)
37483752
zend_long y, m, d;
37493753

37503754
object = ZEND_THIS;
3751-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &y, &m, &d) == FAILURE) {
3752-
RETURN_THROWS();
3753-
}
3755+
ZEND_PARSE_PARAMETERS_START(3, 3)
3756+
Z_PARAM_LONG(y)
3757+
Z_PARAM_LONG(m)
3758+
Z_PARAM_LONG(d)
3759+
ZEND_PARSE_PARAMETERS_END();
37543760

37553761
date_clone_immutable(object, &new_object);
37563762
php_date_date_set(&new_object, y, m, d, return_value);
@@ -3798,9 +3804,12 @@ PHP_METHOD(DateTimeImmutable, setISODate)
37983804
zend_long y, w, d = 1;
37993805

38003806
object = ZEND_THIS;
3801-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|l", &y, &w, &d) == FAILURE) {
3802-
RETURN_THROWS();
3803-
}
3807+
ZEND_PARSE_PARAMETERS_START(2, 3)
3808+
Z_PARAM_LONG(y)
3809+
Z_PARAM_LONG(w)
3810+
Z_PARAM_OPTIONAL
3811+
Z_PARAM_LONG(d)
3812+
ZEND_PARSE_PARAMETERS_END();
38043813

38053814
date_clone_immutable(object, &new_object);
38063815
php_date_isodate_set(&new_object, y, w, d, return_value);
@@ -3843,9 +3852,9 @@ PHP_METHOD(DateTimeImmutable, setTimestamp)
38433852
zend_long timestamp;
38443853

38453854
object = ZEND_THIS;
3846-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &timestamp) == FAILURE) {
3847-
RETURN_THROWS();
3848-
}
3855+
ZEND_PARSE_PARAMETERS_START(1, 1)
3856+
Z_PARAM_LONG(timestamp)
3857+
ZEND_PARSE_PARAMETERS_END();
38493858

38503859
date_clone_immutable(object, &new_object);
38513860
php_date_timestamp_set(&new_object, timestamp, return_value);
@@ -3861,9 +3870,9 @@ PHP_METHOD(DateTimeImmutable, setMicrosecond)
38613870
php_date_obj *dateobj, *new_dateobj;
38623871
zend_long us;
38633872

3864-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &us) == FAILURE) {
3865-
RETURN_THROWS();
3866-
}
3873+
ZEND_PARSE_PARAMETERS_START(1, 1)
3874+
Z_PARAM_LONG(us)
3875+
ZEND_PARSE_PARAMETERS_END();
38673876

38683877
if (UNEXPECTED(us < 0 || us > 999999)) {
38693878
zend_argument_error(
@@ -3895,9 +3904,9 @@ PHP_METHOD(DateTime, setMicrosecond)
38953904
php_date_obj *dateobj;
38963905
zend_long us;
38973906

3898-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &us) == FAILURE) {
3899-
RETURN_THROWS();
3900-
}
3907+
ZEND_PARSE_PARAMETERS_START(1, 1)
3908+
Z_PARAM_LONG(us)
3909+
ZEND_PARSE_PARAMETERS_END();
39013910

39023911
if (UNEXPECTED(us < 0 || us > 999999)) {
39033912
zend_argument_error(
@@ -5117,9 +5126,11 @@ PHP_METHOD(DatePeriod, createFromISO8601String)
51175126
char *isostr = NULL;
51185127
size_t isostr_len = 0;
51195128

5120-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &isostr, &isostr_len, &options) == FAILURE) {
5121-
RETURN_THROWS();
5122-
}
5129+
ZEND_PARSE_PARAMETERS_START(1, 2)
5130+
Z_PARAM_STRING(isostr, isostr_len)
5131+
Z_PARAM_OPTIONAL
5132+
Z_PARAM_LONG(options)
5133+
ZEND_PARSE_PARAMETERS_END();
51235134

51245135
object_init_ex(return_value, execute_data->This.value.ce ? execute_data->This.value.ce : date_ce_period);
51255136
dpobj = Z_PHPPERIOD_P(return_value);

0 commit comments

Comments
 (0)