@@ -4699,7 +4699,6 @@ PHP_FUNCTION(exif_read_data)
4699
4699
PHP_FUNCTION (exif_thumbnail )
4700
4700
{
4701
4701
bool ret ;
4702
- int arg_c = ZEND_NUM_ARGS ();
4703
4702
image_info_type ImageInfo ;
4704
4703
zval * stream ;
4705
4704
zval * z_width = NULL , * z_height = NULL , * z_imagetype = NULL ;
@@ -4731,7 +4730,7 @@ PHP_FUNCTION(exif_thumbnail)
4731
4730
RETURN_THROWS ();
4732
4731
}
4733
4732
4734
- if (CHECK_NULL_PATH ( Z_STRVAL_P ( stream ), Z_STRLEN_P (stream ))) {
4733
+ if (zend_str_has_nul_byte ( Z_STR_P (stream ))) {
4735
4734
zend_argument_value_error (1 , "must not contain any null bytes" );
4736
4735
RETURN_THROWS ();
4737
4736
}
@@ -4756,17 +4755,19 @@ PHP_FUNCTION(exif_thumbnail)
4756
4755
exif_error_docref (NULL EXIFERR_CC , & ImageInfo , E_NOTICE , "Returning thumbnail(%d)" , ImageInfo .Thumbnail .size );
4757
4756
#endif
4758
4757
4759
- ZVAL_STRINGL (return_value , ImageInfo .Thumbnail .data , ImageInfo .Thumbnail .size );
4760
- if (arg_c >= 3 ) {
4761
- if (!ImageInfo .Thumbnail .width || !ImageInfo .Thumbnail .height ) {
4762
- if (!exif_scan_thumbnail (& ImageInfo )) {
4763
- ImageInfo .Thumbnail .width = ImageInfo .Thumbnail .height = 0 ;
4764
- }
4758
+ RETVAL_STRINGL (ImageInfo .Thumbnail .data , ImageInfo .Thumbnail .size );
4759
+ if ((z_width || z_height ) && (!ImageInfo .Thumbnail .width || !ImageInfo .Thumbnail .height )) {
4760
+ if (!exif_scan_thumbnail (& ImageInfo )) {
4761
+ ImageInfo .Thumbnail .width = ImageInfo .Thumbnail .height = 0 ;
4765
4762
}
4763
+ }
4764
+ if (z_width ) {
4766
4765
ZEND_TRY_ASSIGN_REF_LONG (z_width , ImageInfo .Thumbnail .width );
4766
+ }
4767
+ if (z_height ) {
4767
4768
ZEND_TRY_ASSIGN_REF_LONG (z_height , ImageInfo .Thumbnail .height );
4768
4769
}
4769
- if (arg_c >= 4 ) {
4770
+ if (z_imagetype ) {
4770
4771
ZEND_TRY_ASSIGN_REF_LONG (z_imagetype , ImageInfo .Thumbnail .filetype );
4771
4772
}
4772
4773
0 commit comments