]> granicus.if.org Git - php/commitdiff
Convert exif functions arginfo to php stubs
authorCraig Duncan <git@duncanc.co.uk>
Thu, 15 Aug 2019 19:47:15 +0000 (21:47 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 26 Aug 2019 15:25:12 +0000 (17:25 +0200)
We also allow sections needed to be null.

ext/exif/exif.c
ext/exif/exif.stub.php [new file with mode: 0644]
ext/exif/exif_arginfo.h [new file with mode: 0644]

index 8ad018b31dafa2d1bd772201dba4a627051149e2..e9efa325a14c7b746b6a4e06a8def275f688a916 100644 (file)
@@ -42,6 +42,7 @@
 #endif
 
 #include "php_exif.h"
+#include "exif_arginfo.h"
 #include <math.h>
 #include "php_ini.h"
 #include "ext/standard/php_string.h"
@@ -66,31 +67,6 @@ 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[] = {
@@ -4391,7 +4367,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 (file)
index 0000000..a878c3c
--- /dev/null
@@ -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 (file)
index 0000000..2e449de
--- /dev/null
@@ -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()