File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -3956,6 +3956,11 @@ PHP_FUNCTION(imagescale)
39563956
39573957	im  =  php_gd_libgdimageptr_from_zval_p (IM );
39583958
3959+ 	if  (tmp_h  <  0  &&  tmp_w  <  0 ) {
3960+ 		zend_value_error ("Argument #2 ($width) and argument #3 ($height) cannot be both negative" );
3961+ 		RETURN_THROWS ();
3962+ 	}
3963+ 
39593964	if  (tmp_h  <  0  ||  tmp_w  <  0 ) {
39603965		/* preserve ratio */ 
39613966		long  src_x , src_y ;
Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-17703 both width and height value being negative triggers ValueError on width.
3+ --EXTENSIONS--
4+ gd
5+ --FILE--
6+ <?php 
7+ 
8+ $ imgimagecreatetruecolor  ( 256 , 1 );
9+ 
10+ try  {
11+ 	imagescale ($ img1 , -1 , 0 );
12+ } catch  (\ValueError   $ e
13+ 	echo  $ egetMessage ();
14+ }
15+ ?> 
16+ --EXPECT--
17+ Argument #2 ($width) and argument #3 ($height) cannot be both negative
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments