@@ -5077,6 +5077,9 @@ static bool php_date_period_initialize_from_hash(php_period_obj *period_obj, Has
5077
5077
if (Z_TYPE_P (ht_entry ) == IS_OBJECT && instanceof_function (Z_OBJCE_P (ht_entry ), date_ce_interface )) {
5078
5078
php_date_obj * date_obj ;
5079
5079
date_obj = Z_PHPDATE_P (ht_entry );
5080
+ if (period_obj -> start != NULL ) {
5081
+ timelib_time_dtor (period_obj -> start );
5082
+ }
5080
5083
period_obj -> start = timelib_time_clone (date_obj -> time );
5081
5084
period_obj -> start_ce = Z_OBJCE_P (ht_entry );
5082
5085
} else if (Z_TYPE_P (ht_entry ) != IS_NULL ) {
@@ -5091,6 +5094,9 @@ static bool php_date_period_initialize_from_hash(php_period_obj *period_obj, Has
5091
5094
if (Z_TYPE_P (ht_entry ) == IS_OBJECT && instanceof_function (Z_OBJCE_P (ht_entry ), date_ce_interface )) {
5092
5095
php_date_obj * date_obj ;
5093
5096
date_obj = Z_PHPDATE_P (ht_entry );
5097
+ if (period_obj -> end != NULL ) {
5098
+ timelib_time_dtor (period_obj -> end );
5099
+ }
5094
5100
period_obj -> end = timelib_time_clone (date_obj -> time );
5095
5101
} else if (Z_TYPE_P (ht_entry ) != IS_NULL ) {
5096
5102
return 0 ;
@@ -5104,6 +5110,9 @@ static bool php_date_period_initialize_from_hash(php_period_obj *period_obj, Has
5104
5110
if (Z_TYPE_P (ht_entry ) == IS_OBJECT && instanceof_function (Z_OBJCE_P (ht_entry ), date_ce_interface )) {
5105
5111
php_date_obj * date_obj ;
5106
5112
date_obj = Z_PHPDATE_P (ht_entry );
5113
+ if (period_obj -> current != NULL ) {
5114
+ timelib_time_dtor (period_obj -> current );
5115
+ }
5107
5116
period_obj -> current = timelib_time_clone (date_obj -> time );
5108
5117
} else if (Z_TYPE_P (ht_entry ) != IS_NULL ) {
5109
5118
return 0 ;
@@ -5117,6 +5126,9 @@ static bool php_date_period_initialize_from_hash(php_period_obj *period_obj, Has
5117
5126
if (Z_TYPE_P (ht_entry ) == IS_OBJECT && Z_OBJCE_P (ht_entry ) == date_ce_interval ) {
5118
5127
php_interval_obj * interval_obj ;
5119
5128
interval_obj = Z_PHPINTERVAL_P (ht_entry );
5129
+ if (period_obj -> interval != NULL ) {
5130
+ timelib_rel_time_dtor (period_obj -> interval );
5131
+ }
5120
5132
period_obj -> interval = timelib_rel_time_clone (interval_obj -> diff );
5121
5133
} else { /* interval is required */
5122
5134
return 0 ;
0 commit comments