@@ -4124,7 +4124,6 @@ PHP_METHOD(DatePeriod, __construct)
4124
4124
timelib_time * clone ;
4125
4125
zend_error_handling error_handling ;
4126
4126
4127
- zend_replace_error_handling (EH_THROW , NULL , & error_handling );
4128
4127
ZEND_PARSE_PARAMETERS_START (1 , 4 )
4129
4128
Z_PARAM_STR_OR_OBJ_OF_CLASS (start_str , start_obj , date_ce_interface )
4130
4129
Z_PARAM_OPTIONAL
@@ -4139,28 +4138,32 @@ PHP_METHOD(DatePeriod, __construct)
4139
4138
if (start_str ) {
4140
4139
if (interval_obj ) {
4141
4140
zend_argument_type_error (2 , "must be of type ?int when argument #1 ($start) is a string" );
4142
- zend_restore_error_handling (& error_handling );
4143
4141
RETURN_THROWS ();
4144
4142
}
4145
4143
4146
4144
if (!end_is_null ) {
4147
4145
zend_argument_value_error (3 , "must be null when argument #1 ($start) is a string" );
4148
- zend_restore_error_handling (& error_handling );
4149
4146
RETURN_THROWS ();
4150
4147
}
4151
4148
4152
4149
isostr = ZSTR_VAL (start_str );
4153
4150
isostr_len = ZSTR_LEN (start_str );
4154
4151
4152
+ zend_replace_error_handling (EH_THROW , NULL , & error_handling );
4155
4153
date_period_initialize (& (dpobj -> start ), & (dpobj -> end ), & (dpobj -> interval ), & recurrences , isostr , isostr_len );
4154
+ zend_restore_error_handling (& error_handling );
4155
+
4156
4156
if (dpobj -> start == NULL ) {
4157
4157
zend_argument_error (zend_ce_exception , 1 , "must contain a start date, \"%s\" given" , isostr );
4158
+ RETURN_THROWS ();
4158
4159
}
4159
4160
if (dpobj -> interval == NULL ) {
4160
4161
zend_argument_error (zend_ce_exception , 1 , "must contain an interval, \"%s\" given" , isostr );
4162
+ RETURN_THROWS ();
4161
4163
}
4162
4164
if (dpobj -> end == NULL && recurrences == 0 ) {
4163
4165
zend_argument_error (zend_ce_exception , 1 , "must contain an end date or a recurrence count, \"%s\" given" , isostr );
4166
+ RETURN_THROWS ();
4164
4167
}
4165
4168
4166
4169
if (dpobj -> start ) {
@@ -4173,13 +4176,11 @@ PHP_METHOD(DatePeriod, __construct)
4173
4176
} else {
4174
4177
if (!interval_obj ) {
4175
4178
zend_argument_type_error (2 , "must be of type DateInterval when argument #1 ($start) is a DateTimeInterface" );
4176
- zend_restore_error_handling (& error_handling );
4177
4179
RETURN_THROWS ();
4178
4180
}
4179
4181
4180
4182
if (end_is_null ) {
4181
4183
zend_argument_type_error (2 , "must be of type DateTimeInterface|int when argument #1 ($start) is a DateTimeInterface" );
4182
- zend_restore_error_handling (& error_handling );
4183
4184
RETURN_THROWS ();
4184
4185
}
4185
4186
@@ -4212,6 +4213,7 @@ PHP_METHOD(DatePeriod, __construct)
4212
4213
4213
4214
if (dpobj -> end == NULL && recurrences < 1 ) {
4214
4215
zend_argument_error (zend_ce_exception , 3 , "must be greater than 0" );
4216
+ RETURN_THROWS ();
4215
4217
}
4216
4218
4217
4219
/* options */
@@ -4221,8 +4223,6 @@ PHP_METHOD(DatePeriod, __construct)
4221
4223
dpobj -> recurrences = recurrences + dpobj -> include_start_date ;
4222
4224
4223
4225
dpobj -> initialized = 1 ;
4224
-
4225
- zend_restore_error_handling (& error_handling );
4226
4226
}
4227
4227
/* }}} */
4228
4228
0 commit comments