@@ -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,8 +4755,8 @@ 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 ) {
4758
+ RETVAL_STRINGL ( ImageInfo .Thumbnail .data , ImageInfo .Thumbnail .size );
4759
+ if (z_height ) {
4761
4760
if (!ImageInfo .Thumbnail .width || !ImageInfo .Thumbnail .height ) {
4762
4761
if (!exif_scan_thumbnail (& ImageInfo )) {
4763
4762
ImageInfo .Thumbnail .width = ImageInfo .Thumbnail .height = 0 ;
@@ -4766,7 +4765,7 @@ PHP_FUNCTION(exif_thumbnail)
4766
4765
ZEND_TRY_ASSIGN_REF_LONG (z_width , ImageInfo .Thumbnail .width );
4767
4766
ZEND_TRY_ASSIGN_REF_LONG (z_height , ImageInfo .Thumbnail .height );
4768
4767
}
4769
- if (arg_c >= 4 ) {
4768
+ if (z_imagetype ) {
4770
4769
ZEND_TRY_ASSIGN_REF_LONG (z_imagetype , ImageInfo .Thumbnail .filetype );
4771
4770
}
4772
4771
0 commit comments