@@ -4270,7 +4270,8 @@ static bool date_interval_initialize(timelib_rel_time **rt, /*const*/ char *form
4270
4270
return retval ;
4271
4271
} /* }}} */
4272
4272
4273
- static int date_interval_compare_objects (zval * o1 , zval * o2 ) {
4273
+ static int date_interval_compare_objects (zval * o1 , zval * o2 )
4274
+ {
4274
4275
ZEND_COMPARE_OBJECTS_FALLBACK (o1 , o2 );
4275
4276
/* There is no well defined way to compare intervals like P1M and P30D, which may compare
4276
4277
* smaller, equal or greater depending on the point in time at which the interval starts. As
@@ -4843,7 +4844,8 @@ static bool date_period_initialize(timelib_time **st, timelib_time **et, timelib
4843
4844
return retval ;
4844
4845
} /* }}} */
4845
4846
4846
- 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
+ {
4847
4849
if (!date_period_initialize (& (dpobj -> start ), & (dpobj -> end ), & (dpobj -> interval ), recurrences , isostr , isostr_len )) {
4848
4850
return false;
4849
4851
}
@@ -4873,12 +4875,13 @@ static bool date_period_init_iso8601_string(php_period_obj *dpobj, char *isostr,
4873
4875
if (dpobj -> end ) {
4874
4876
timelib_update_ts (dpobj -> end , NULL );
4875
4877
}
4876
- dpobj -> start_ce = date_ce_date ;
4878
+ dpobj -> start_ce = base_ce ;
4877
4879
4878
4880
return true;
4879
4881
}
4880
4882
4881
- 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
+ {
4882
4885
if (dpobj -> end == NULL && recurrences < 1 ) {
4883
4886
zend_string * func = get_active_function_or_method_name ();
4884
4887
zend_throw_exception_ex (date_ce_date_malformed_period_string_exception , 0 , "%s(): Recurrence count must be greater than 0" , ZSTR_VAL (func ));
@@ -4916,7 +4919,7 @@ PHP_METHOD(DatePeriod, createFromISO8601String)
4916
4919
4917
4920
dpobj -> current = NULL ;
4918
4921
4919
- 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 )) {
4920
4923
RETURN_THROWS ();
4921
4924
}
4922
4925
@@ -4949,7 +4952,7 @@ PHP_METHOD(DatePeriod, __construct)
4949
4952
dpobj -> current = NULL ;
4950
4953
4951
4954
if (isostr ) {
4952
- 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 )) {
4953
4956
RETURN_THROWS ();
4954
4957
}
4955
4958
} else {
0 commit comments