@@ -5226,6 +5226,23 @@ PHP_METHOD(DatePeriod, createFromISO8601String)
52265226 }
52275227}
52285228
5229+ static void date_period_reset (php_period_obj * period_obj )
5230+ {
5231+ if (period_obj -> start ) {
5232+ timelib_time_dtor (period_obj -> start );
5233+ }
5234+ if (period_obj -> current ) {
5235+ timelib_time_dtor (period_obj -> current );
5236+ }
5237+ if (period_obj -> end ) {
5238+ timelib_time_dtor (period_obj -> end );
5239+ }
5240+ if (period_obj -> interval ) {
5241+ timelib_rel_time_dtor (period_obj -> interval );
5242+ }
5243+ memset (period_obj , 0 , XtOffsetOf (php_period_obj , std ));
5244+ }
5245+
52295246/* {{{ Creates new DatePeriod object. */
52305247PHP_METHOD (DatePeriod , __construct )
52315248{
@@ -5247,7 +5264,7 @@ PHP_METHOD(DatePeriod, __construct)
52475264 }
52485265
52495266 dpobj = Z_PHPPERIOD_P (ZEND_THIS );
5250- dpobj -> current = NULL ;
5267+ date_period_reset ( dpobj ) ;
52515268
52525269 if (isostr ) {
52535270 zend_error (E_DEPRECATED , "Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, "
@@ -5265,6 +5282,7 @@ PHP_METHOD(DatePeriod, __construct)
52655282 if (end ) {
52665283 DATE_CHECK_INITIALIZED (Z_PHPDATE_P (end )-> time , date_ce_interface );
52675284 }
5285+ DATE_CHECK_INITIALIZED (Z_PHPINTERVAL_P (interval )-> initialized , Z_OBJCE_P (interval ));
52685286
52695287 /* init */
52705288 php_interval_obj * intobj = Z_PHPINTERVAL_P (interval );
0 commit comments