File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1962,6 +1962,10 @@ static void date_period_it_rewind(zend_object_iterator *iter)
1962
1962
if (iterator -> object -> current ) {
1963
1963
timelib_time_dtor (iterator -> object -> current );
1964
1964
}
1965
+ if (!iterator -> object -> start ) {
1966
+ zend_throw_error (NULL , "DatePeriod has not been initialized correctly" );
1967
+ return ;
1968
+ }
1965
1969
iterator -> object -> current = timelib_time_clone (iterator -> object -> start );
1966
1970
date_period_it_invalidate_current (iter );
1967
1971
}
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #75002 Null Pointer Dereference in timelib_time_clone
3
+ --FILE--
4
+ <?php
5
+
6
+ class aaa extends DatePeriod {
7
+ public function __construct () { }
8
+ }
9
+
10
+ $ start =new DateTime ( '2012-08-01 ' );
11
+
12
+ foreach (new aaa ($ start ) as $ y ) {
13
+ $ a =$ key ;
14
+ }
15
+
16
+ ?>
17
+ ==DONE==
18
+ --EXPECTF--
19
+ Fatal error: Uncaught Error: DatePeriod has not been initialized correctly in %sbug75002.php:%d
20
+ Stack trace:
21
+ #0 {main}
22
+ thrown in %sbug75002.php on line %d
You can’t perform that action at this time.
0 commit comments