Merge branch 'PHP-7.0' into PHP-7.1

* PHP-7.0:
  Fixed bug #75002 Null Pointer Dereference in timelib_time_clone
This commit is contained in:
Anatol Belski 2017-08-02 16:41:48 +02:00
commit 1fdc518971
2 changed files with 26 additions and 0 deletions

View File

@ -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);
}

View File

@ -0,0 +1,22 @@
--TEST--
Bug #75002 Null Pointer Dereference in timelib_time_clone
--FILE--
<?php
class aaa extends DatePeriod {
public function __construct() { }
}
$start=new DateTime( '2012-08-01' );
foreach (new aaa($start) as $y) {
$a=$key;
}
?>
==DONE==
--EXPECTF--
Fatal error: Uncaught Error: DatePeriod has not been initialized correctly in %sbug75002.php:%d
Stack trace:
#0 {main}
thrown in %sbug75002.php on line %d