diff options
Diffstat (limited to 'ext/exif')
| -rw-r--r-- | ext/exif/exif.c | 31 | ||||
| -rw-r--r-- | ext/exif/exif.stub.php | 13 | ||||
| -rw-r--r-- | ext/exif/exif_arginfo.h | 23 | ||||
| -rw-r--r-- | ext/exif/php_exif.h | 2 | ||||
| -rw-r--r-- | ext/exif/tests/exif_imagetype_error.phpt | 17 | ||||
| -rw-r--r-- | ext/exif/tests/exif_read_exif_data_basic-mb.phpt | 64 | ||||
| -rw-r--r-- | ext/exif/tests/exif_read_exif_data_basic.phpt | 64 |
7 files changed, 38 insertions, 176 deletions
diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 680552daf3..4448b9d96b 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | @@ -42,6 +40,7 @@ #endif #include "php_exif.h" +#include "exif_arginfo.h" #include <math.h> #include "php_ini.h" #include "ext/standard/php_string.h" @@ -66,36 +65,10 @@ typedef unsigned char uchar; #define MAX_IFD_NESTING_LEVEL 150 -/* {{{ arginfo */ -ZEND_BEGIN_ARG_INFO(arginfo_exif_tagname, 0) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_read_data, 0, 0, 1) - ZEND_ARG_INFO(0, filename) - ZEND_ARG_INFO(0, sections_needed) - ZEND_ARG_INFO(0, sub_arrays) - ZEND_ARG_INFO(0, read_thumbnail) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_thumbnail, 0, 0, 1) - ZEND_ARG_INFO(0, filename) - ZEND_ARG_INFO(1, width) - ZEND_ARG_INFO(1, height) - ZEND_ARG_INFO(1, imagetype) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_exif_imagetype, 0) - ZEND_ARG_INFO(0, imagefile) -ZEND_END_ARG_INFO() - -/* }}} */ - /* {{{ exif_functions[] */ static const zend_function_entry exif_functions[] = { PHP_FE(exif_read_data, arginfo_exif_read_data) - PHP_DEP_FALIAS(read_exif_data, exif_read_data, arginfo_exif_read_data) PHP_FE(exif_tagname, arginfo_exif_tagname) PHP_FE(exif_thumbnail, arginfo_exif_thumbnail) PHP_FE(exif_imagetype, arginfo_exif_imagetype) @@ -4411,7 +4384,7 @@ PHP_FUNCTION(exif_read_data) ZEND_PARSE_PARAMETERS_START(1, 4) Z_PARAM_ZVAL(stream) Z_PARAM_OPTIONAL - Z_PARAM_STR(z_sections_needed) + Z_PARAM_STR_EX(z_sections_needed, 1, 0) Z_PARAM_BOOL(sub_arrays) Z_PARAM_BOOL(read_thumbnail) ZEND_PARSE_PARAMETERS_END(); diff --git a/ext/exif/exif.stub.php b/ext/exif/exif.stub.php new file mode 100644 index 0000000000..a878c3c3ff --- /dev/null +++ b/ext/exif/exif.stub.php @@ -0,0 +1,13 @@ +<?php + +/** @return string|false */ +function exif_tagname(int $index) {} + +/** @return array|false */ +function exif_read_data($filename, ?string $sections_needed = null, bool $sub_arrays = false, bool $read_thumbnail = false) {} + +/** @return string|false */ +function exif_thumbnail($filename, &$width = null, &$height = null, &$imagetype = null) {} + +/** @return int|false */ +function exif_imagetype(string $filename) {} diff --git a/ext/exif/exif_arginfo.h b/ext/exif/exif_arginfo.h new file mode 100644 index 0000000000..2e449deae1 --- /dev/null +++ b/ext/exif/exif_arginfo.h @@ -0,0 +1,23 @@ +/* This is a generated file, edit the .stub.php file instead. */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_tagname, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_read_data, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_TYPE_INFO(0, sections_needed, IS_STRING, 1) + ZEND_ARG_TYPE_INFO(0, sub_arrays, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, read_thumbnail, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_thumbnail, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(1, width) + ZEND_ARG_INFO(1, height) + ZEND_ARG_INFO(1, imagetype) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_imagetype, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) +ZEND_END_ARG_INFO() diff --git a/ext/exif/php_exif.h b/ext/exif/php_exif.h index 03f4abca84..8cbf70fef3 100644 --- a/ext/exif/php_exif.h +++ b/ext/exif/php_exif.h @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | diff --git a/ext/exif/tests/exif_imagetype_error.phpt b/ext/exif/tests/exif_imagetype_error.phpt index 80538a0f68..765f01d1ea 100644 --- a/ext/exif/tests/exif_imagetype_error.phpt +++ b/ext/exif/tests/exif_imagetype_error.phpt @@ -12,13 +12,6 @@ Test exif_imagetype() function : error conditions echo "*** Testing exif_imagetype() : error conditions ***\n"; -echo "\n-- Testing exif_imagetype() function with no arguments --\n"; -var_dump( exif_imagetype() ); - -echo "\n-- Testing exif_imagetype() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( exif_imagetype(__DIR__.'/test2.jpg', $extra_arg) ); - echo "\n-- Testing exif_imagetype() function with an unknown file --\n"; var_dump( exif_imagetype(__DIR__.'/foo.jpg') ); @@ -28,16 +21,6 @@ var_dump( exif_imagetype(__DIR__.'/foo.jpg') ); --EXPECTF-- *** Testing exif_imagetype() : error conditions *** --- Testing exif_imagetype() function with no arguments -- - -Warning: exif_imagetype() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing exif_imagetype() function with more than expected no. of arguments -- - -Warning: exif_imagetype() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -- Testing exif_imagetype() function with an unknown file -- Warning: exif_imagetype(%s/foo.jpg): failed to open stream: No such file or directory in %s on line %d diff --git a/ext/exif/tests/exif_read_exif_data_basic-mb.phpt b/ext/exif/tests/exif_read_exif_data_basic-mb.phpt deleted file mode 100644 index 70e9ab0401..0000000000 --- a/ext/exif/tests/exif_read_exif_data_basic-mb.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -Check for read_exif_data default behaviour ---SKIPIF-- -<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> ---INI-- -output_handler= -zlib.output_compression=0 ---FILE-- -<?php - -/* Prototype : array read_exif_data ( string $filename [, string $sections [, bool $arrays [, bool $thumbnail ]]] ) - * Description: Alias of exif_read_data() - * Source code: ext/exif/exif.c -*/ -echo "*** Testing read_exif_data() : basic functionality ***\n"; - -print_r(read_exif_data(__DIR__.'/test2私はガラスを食べられます.jpg')); -?> -===Done=== ---EXPECTF-- -*** Testing read_exif_data() : basic functionality *** - -Deprecated: Function read_exif_data() is deprecated in %sexif_read_exif_data_basic-mb.php on line 9 -Array -( - [FileName] => test2私はガラスを食べられます.jpg - [FileDateTime] => %d - [FileSize] => 1240 - [FileType] => 2 - [MimeType] => image/jpeg - [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, COMMENT - [COMPUTED] => Array - ( - [html] => width="1" height="1" - [Height] => 1 - [Width] => 1 - [IsColor] => 1 - [ByteOrderMotorola] => 1 - [UserComment] => Exif test image. - [UserCommentEncoding] => ASCII - [Copyright] => Photo (c) M.Boerger, Edited by M.Boerger. - [Copyright.Photographer] => Photo (c) M.Boerger - [Copyright.Editor] => Edited by M.Boerger. - [Thumbnail.FileType] => 2 - [Thumbnail.MimeType] => image/jpeg - ) - - [Copyright] => Photo (c) M.Boerger - [UserComment] => ASCII - [THUMBNAIL] => Array - ( - [JPEGInterchangeFormat] => 134 - [JPEGInterchangeFormatLength] => 523 - ) - - [COMMENT] => Array - ( - [0] => Comment #1. - [1] => Comment #2. - [2] => Comment #3end - ) - -) -===Done=== diff --git a/ext/exif/tests/exif_read_exif_data_basic.phpt b/ext/exif/tests/exif_read_exif_data_basic.phpt deleted file mode 100644 index 254cd1a164..0000000000 --- a/ext/exif/tests/exif_read_exif_data_basic.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -Check for read_exif_data default behaviour ---SKIPIF-- -<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> ---INI-- -output_handler= -zlib.output_compression=0 ---FILE-- -<?php - -/* Prototype : array read_exif_data ( string $filename [, string $sections [, bool $arrays [, bool $thumbnail ]]] ) - * Description: Alias of exif_read_data() - * Source code: ext/exif/exif.c -*/ -echo "*** Testing read_exif_data() : basic functionality ***\n"; - -print_r(read_exif_data(__DIR__.'/test2.jpg')); -?> -===Done=== ---EXPECTF-- -*** Testing read_exif_data() : basic functionality *** - -Deprecated: Function read_exif_data() is deprecated in %sexif_read_exif_data_basic.php on line 9 -Array -( - [FileName] => test2.jpg - [FileDateTime] => %d - [FileSize] => 1240 - [FileType] => 2 - [MimeType] => image/jpeg - [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, COMMENT - [COMPUTED] => Array - ( - [html] => width="1" height="1" - [Height] => 1 - [Width] => 1 - [IsColor] => 1 - [ByteOrderMotorola] => 1 - [UserComment] => Exif test image. - [UserCommentEncoding] => ASCII - [Copyright] => Photo (c) M.Boerger, Edited by M.Boerger. - [Copyright.Photographer] => Photo (c) M.Boerger - [Copyright.Editor] => Edited by M.Boerger. - [Thumbnail.FileType] => 2 - [Thumbnail.MimeType] => image/jpeg - ) - - [Copyright] => Photo (c) M.Boerger - [UserComment] => ASCII - [THUMBNAIL] => Array - ( - [JPEGInterchangeFormat] => 134 - [JPEGInterchangeFormatLength] => 523 - ) - - [COMMENT] => Array - ( - [0] => Comment #1. - [1] => Comment #2. - [2] => Comment #3end - ) - -) -===Done=== |
