@@ -4699,7 +4699,6 @@ PHP_FUNCTION(exif_read_data)
46994699PHP_FUNCTION (exif_thumbnail )
47004700{
47014701 bool ret ;
4702- int arg_c = ZEND_NUM_ARGS ();
47034702 image_info_type ImageInfo ;
47044703 zval * stream ;
47054704 zval * z_width = NULL , * z_height = NULL , * z_imagetype = NULL ;
@@ -4731,7 +4730,7 @@ PHP_FUNCTION(exif_thumbnail)
47314730 RETURN_THROWS ();
47324731 }
47334732
4734- if (CHECK_NULL_PATH ( Z_STRVAL_P ( stream ), Z_STRLEN_P (stream ))) {
4733+ if (zend_str_has_nul_byte ( Z_STR_P (stream ))) {
47354734 zend_argument_value_error (1 , "must not contain any null bytes" );
47364735 RETURN_THROWS ();
47374736 }
@@ -4756,17 +4755,19 @@ PHP_FUNCTION(exif_thumbnail)
47564755 exif_error_docref (NULL EXIFERR_CC , & ImageInfo , E_NOTICE , "Returning thumbnail(%d)" , ImageInfo .Thumbnail .size );
47574756#endif
47584757
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 ;
47654762 }
4763+ }
4764+ if (z_width ) {
47664765 ZEND_TRY_ASSIGN_REF_LONG (z_width , ImageInfo .Thumbnail .width );
4766+ }
4767+ if (z_height ) {
47674768 ZEND_TRY_ASSIGN_REF_LONG (z_height , ImageInfo .Thumbnail .height );
47684769 }
4769- if (arg_c >= 4 ) {
4770+ if (z_imagetype ) {
47704771 ZEND_TRY_ASSIGN_REF_LONG (z_imagetype , ImageInfo .Thumbnail .filetype );
47714772 }
47724773
0 commit comments