@@ -4980,6 +4980,23 @@ PHP_METHOD(DatePeriod, createFromISO8601String)
49804980 }
49814981}
49824982
4983+ static void date_period_reset (php_period_obj * period_obj )
4984+ {
4985+ if (period_obj -> start ) {
4986+ timelib_time_dtor (period_obj -> start );
4987+ }
4988+ if (period_obj -> current ) {
4989+ timelib_time_dtor (period_obj -> current );
4990+ }
4991+ if (period_obj -> end ) {
4992+ timelib_time_dtor (period_obj -> end );
4993+ }
4994+ if (period_obj -> interval ) {
4995+ timelib_rel_time_dtor (period_obj -> interval );
4996+ }
4997+ memset (period_obj , 0 , XtOffsetOf (php_period_obj , std ));
4998+ }
4999+
49835000/* {{{ Creates new DatePeriod object. */
49845001PHP_METHOD (DatePeriod , __construct )
49855002{
@@ -5001,7 +5018,7 @@ PHP_METHOD(DatePeriod, __construct)
50015018 }
50025019
50035020 dpobj = Z_PHPPERIOD_P (ZEND_THIS );
5004- dpobj -> current = NULL ;
5021+ date_period_reset ( dpobj ) ;
50055022
50065023 if (isostr ) {
50075024 if (!date_period_init_iso8601_string (dpobj , date_ce_date , isostr , isostr_len , options , & recurrences )) {
@@ -5013,6 +5030,7 @@ PHP_METHOD(DatePeriod, __construct)
50135030 if (end ) {
50145031 DATE_CHECK_INITIALIZED (Z_PHPDATE_P (end )-> time , date_ce_interface );
50155032 }
5033+ DATE_CHECK_INITIALIZED (Z_PHPINTERVAL_P (interval )-> initialized , Z_OBJCE_P (interval ));
50165034
50175035 /* init */
50185036 php_interval_obj * intobj = Z_PHPINTERVAL_P (interval );
0 commit comments