summaryrefslogtreecommitdiff
path: root/ext/fileinfo/fileinfo.c
diff options
context:
space:
mode:
authorCraig Duncan <git@duncanc.co.uk>2019-08-26 17:21:38 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2019-08-26 18:13:58 +0200
commit4836660b9070b9eef0d30b8ba43f8c82dbbded1f (patch)
tree06635d19b7a98c702736024c66faed92faa24f9e /ext/fileinfo/fileinfo.c
parent38c2230d079eb1f1b13750e0629c3e5217333cb7 (diff)
downloadphp-git-4836660b9070b9eef0d30b8ba43f8c82dbbded1f.tar.gz
Convert fileinfo functions arginfo to php stubs
We also allow the context for finfo to be null.
Diffstat (limited to 'ext/fileinfo/fileinfo.c')
-rw-r--r--ext/fileinfo/fileinfo.c63
1 files changed, 7 insertions, 56 deletions
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
index 621e82c75a..2c5e4209c7 100644
--- a/ext/fileinfo/fileinfo.c
+++ b/ext/fileinfo/fileinfo.c
@@ -34,6 +34,7 @@
#include "ext/standard/info.h"
#include "ext/standard/file.h" /* needed for context stuff */
#include "php_fileinfo.h"
+#include "fileinfo_arginfo.h"
#include "fopen_wrappers.h" /* needed for is_url */
#include "Zend/zend_exceptions.h"
@@ -108,63 +109,13 @@ PHP_FILEINFO_API zend_object *finfo_objects_new(zend_class_entry *class_type)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_open, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_close, 0, 0, 1)
- ZEND_ARG_INFO(0, finfo)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_set_flags, 0, 0, 2)
- ZEND_ARG_INFO(0, finfo)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_method_set_flags, 0, 0, 1)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_file, 0, 0, 2)
- ZEND_ARG_INFO(0, finfo)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_method_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_buffer, 0, 0, 2)
- ZEND_ARG_INFO(0, finfo)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_method_buffer, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mime_content_type, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ finfo_class_functions
*/
static const zend_function_entry finfo_class_functions[] = {
- ZEND_ME_MAPPING(__construct, finfo_open, arginfo_finfo_open, ZEND_ACC_PUBLIC)
- ZEND_ME_MAPPING(set_flags, finfo_set_flags,arginfo_finfo_method_set_flags, ZEND_ACC_PUBLIC)
- ZEND_ME_MAPPING(file, finfo_file, arginfo_finfo_method_file, ZEND_ACC_PUBLIC)
- ZEND_ME_MAPPING(buffer, finfo_buffer, arginfo_finfo_method_buffer, ZEND_ACC_PUBLIC)
+ ZEND_ME_MAPPING(__construct, finfo_open, arginfo_class_finfo___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME_MAPPING(set_flags, finfo_set_flags,arginfo_class_finfo_set_flags, ZEND_ACC_PUBLIC)
+ ZEND_ME_MAPPING(file, finfo_file, arginfo_class_finfo_file, ZEND_ACC_PUBLIC)
+ ZEND_ME_MAPPING(buffer, finfo_buffer, arginfo_class_finfo_buffer, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
@@ -470,13 +421,13 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
goto common;
}
} else if (object) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lr", &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lr!", &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
return;
}
FILEINFO_FROM_OBJECT(finfo, object);
magic = finfo->magic;
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|lr", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|lr!", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
return;
}
if ((finfo = (php_fileinfo *)zend_fetch_resource(Z_RES_P(zfinfo), "file_info", le_fileinfo)) == NULL) {