php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch date-period-ctor-75002.txt.diff for SPL related Bug #75002

Patch version 2017-07-28 11:40 UTC

Return to Bug #75002 | Download this patch
Patch Revisions:

Developer: derick@php.net

diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index dcc71a402b..fb98fab893 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -1944,6 +1944,10 @@ static void date_period_it_rewind(zend_object_iterator *iter)
 	if (iterator->object->current) {
 		timelib_time_dtor(iterator->object->current);
 	}
+	if (!iterator->object->start) {
+		zend_throw_error(NULL, "DatePeriod has not been initialized correctly");
+		return;
+	}
 	iterator->object->current = timelib_time_clone(iterator->object->start);
 	date_period_it_invalidate_current(iter);
 }
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Feb 18 00:01:25 2020 UTC