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)
19621962	if  (iterator -> object -> current ) {
19631963		timelib_time_dtor (iterator -> object -> current );
19641964	}
1965+ 	if  (!iterator -> object -> start ) {
1966+ 		zend_throw_error (NULL , "DatePeriod has not been initialized correctly" );
1967+ 		return ;
1968+ 	}
19651969	iterator -> object -> current  =  timelib_time_clone (iterator -> object -> start );
19661970	date_period_it_invalidate_current (iter );
19671971}
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