@@ -4844,7 +4844,8 @@ static bool date_period_initialize(timelib_time **st, timelib_time **et, timelib
4844
4844
return retval ;
4845
4845
} /* }}} */
4846
4846
4847
- static bool date_period_init_iso8601_string (php_period_obj * dpobj , char * isostr , size_t isostr_len , zend_long options , zend_long * recurrences ) {
4847
+ static bool date_period_init_iso8601_string (php_period_obj * dpobj , zend_class_entry * base_ce , char * isostr , size_t isostr_len , zend_long options , zend_long * recurrences )
4848
+ {
4848
4849
if (!date_period_initialize (& (dpobj -> start ), & (dpobj -> end ), & (dpobj -> interval ), recurrences , isostr , isostr_len )) {
4849
4850
return false;
4850
4851
}
@@ -4874,12 +4875,13 @@ static bool date_period_init_iso8601_string(php_period_obj *dpobj, char *isostr,
4874
4875
if (dpobj -> end ) {
4875
4876
timelib_update_ts (dpobj -> end , NULL );
4876
4877
}
4877
- dpobj -> start_ce = date_ce_date ;
4878
+ dpobj -> start_ce = base_ce ;
4878
4879
4879
4880
return true;
4880
4881
}
4881
4882
4882
- static bool date_period_init_finish (php_period_obj * dpobj , zend_long options , zend_long recurrences ) {
4883
+ static bool date_period_init_finish (php_period_obj * dpobj , zend_long options , zend_long recurrences )
4884
+ {
4883
4885
if (dpobj -> end == NULL && recurrences < 1 ) {
4884
4886
zend_string * func = get_active_function_or_method_name ();
4885
4887
zend_throw_exception_ex (date_ce_date_malformed_period_string_exception , 0 , "%s(): Recurrence count must be greater than 0" , ZSTR_VAL (func ));
@@ -4917,7 +4919,7 @@ PHP_METHOD(DatePeriod, createFromISO8601String)
4917
4919
4918
4920
dpobj -> current = NULL ;
4919
4921
4920
- if (!date_period_init_iso8601_string (dpobj , isostr , isostr_len , options , & recurrences )) {
4922
+ if (!date_period_init_iso8601_string (dpobj , date_ce_immutable , isostr , isostr_len , options , & recurrences )) {
4921
4923
RETURN_THROWS ();
4922
4924
}
4923
4925
@@ -4950,7 +4952,7 @@ PHP_METHOD(DatePeriod, __construct)
4950
4952
dpobj -> current = NULL ;
4951
4953
4952
4954
if (isostr ) {
4953
- if (!date_period_init_iso8601_string (dpobj , isostr , isostr_len , options , & recurrences )) {
4955
+ if (!date_period_init_iso8601_string (dpobj , date_ce_date , isostr , isostr_len , options , & recurrences )) {
4954
4956
RETURN_THROWS ();
4955
4957
}
4956
4958
} else {
0 commit comments