Skip to content

Commit 7461f1f

Browse files
committed
MFB
1 parent f0290a7 commit 7461f1f

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

ext/exif/exif.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3909,19 +3909,22 @@ PHP_FUNCTION(exif_read_data)
39093909
Reads the embedded thumbnail */
39103910
PHP_FUNCTION(exif_thumbnail)
39113911
{
3912-
zval **p_name, **p_width, **p_height, **p_imagetype;
3913-
int ret, arg_c = ZEND_NUM_ARGS();
3912+
zval *p_width, *p_height, *p_imagetype;
3913+
char *p_name;
3914+
int p_name_len, ret, arg_c = ZEND_NUM_ARGS();
39143915
image_info_type ImageInfo;
39153916

39163917
memset(&ImageInfo, 0, sizeof(ImageInfo));
39173918

3918-
if ((arg_c!=1 && arg_c!=3 && arg_c!=4) || zend_get_parameters_ex(arg_c, &p_name, &p_width, &p_height, &p_imagetype) == FAILURE) {
3919+
if (arg_c!=1 && arg_c!=3 && arg_c!=4) {
39193920
WRONG_PARAM_COUNT;
39203921
}
39213922

3922-
convert_to_string_ex(p_name);
3923+
if (zend_parse_parameters(arg_c TSRMLS_CC, "s|z/z/z/", &p_name, &p_name_len, &p_width, &p_height, &p_imagetype) == FAILURE) {
3924+
return;
3925+
}
39233926

3924-
ret = exif_read_file(&ImageInfo, Z_STRVAL_PP(p_name), 1, 0 TSRMLS_CC);
3927+
ret = exif_read_file(&ImageInfo, p_name, 1, 0 TSRMLS_CC);
39253928
if (ret==FALSE) {
39263929
RETURN_FALSE;
39273930
}
@@ -3943,11 +3946,14 @@ PHP_FUNCTION(exif_thumbnail)
39433946
if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
39443947
exif_scan_thumbnail(&ImageInfo TSRMLS_CC);
39453948
}
3946-
ZVAL_LONG(*p_width, ImageInfo.Thumbnail.width);
3947-
ZVAL_LONG(*p_height, ImageInfo.Thumbnail.height);
3949+
zval_dtor(p_width);
3950+
zval_dtor(p_height);
3951+
ZVAL_LONG(p_width, ImageInfo.Thumbnail.width);
3952+
ZVAL_LONG(p_height, ImageInfo.Thumbnail.height);
39483953
}
39493954
if (arg_c >= 4) {
3950-
ZVAL_LONG(*p_imagetype, ImageInfo.Thumbnail.filetype);
3955+
zval_dtor(p_imagetype);
3956+
ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype);
39513957
}
39523958

39533959
#ifdef EXIF_DEBUG
@@ -3957,7 +3963,7 @@ PHP_FUNCTION(exif_thumbnail)
39573963
exif_discard_imageinfo(&ImageInfo);
39583964

39593965
#ifdef EXIF_DEBUG
3960-
php_error_docref1(NULL TSRMLS_CC, Z_STRVAL_PP(p_name), E_NOTICE, "done");
3966+
php_error_docref1(NULL TSRMLS_CC, p_name, E_NOTICE, "done");
39613967
#endif
39623968
}
39633969
/* }}} */

0 commit comments

Comments
 (0)