summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-02-10 12:18:42 +0100
committerNikita Popov <nikita.ppv@gmail.com>2021-02-10 12:18:42 +0100
commitfd5ff37db77b52b39d97c5749dcbbf4b09c10d9d (patch)
treecdbbdf9b3a4af8ff9b0fe0f96d1a0cb3e5deefd0
parentce7935e82a31a312852c6fa738b10a8223bd8a7a (diff)
downloadphp-git-fd5ff37db77b52b39d97c5749dcbbf4b09c10d9d.tar.gz
Make finfo_open() $magic_database nullable
Empty string was interpreted as a special value here, which indicates that the default magic database should be used. It makes more sense to use null for this purpose. The documentation also explicitly mentions that null can be used.
-rw-r--r--ext/fileinfo/fileinfo.c2
-rw-r--r--ext/fileinfo/fileinfo.stub.php4
-rw-r--r--ext/fileinfo/fileinfo_arginfo.h4
3 files changed, 5 insertions, 5 deletions
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
index add971b6d6..cfb933bdb8 100644
--- a/ext/fileinfo/fileinfo.c
+++ b/ext/fileinfo/fileinfo.c
@@ -215,7 +215,7 @@ PHP_FUNCTION(finfo_open)
char resolved_path[MAXPATHLEN];
zend_error_handling zeh;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lp", &options, &file, &file_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lp!", &options, &file, &file_len) == FAILURE) {
RETURN_THROWS();
}
diff --git a/ext/fileinfo/fileinfo.stub.php b/ext/fileinfo/fileinfo.stub.php
index 9355a96a2b..4ed4e445f1 100644
--- a/ext/fileinfo/fileinfo.stub.php
+++ b/ext/fileinfo/fileinfo.stub.php
@@ -5,7 +5,7 @@
class finfo
{
/** @alias finfo_open */
- public function __construct(int $flags = FILEINFO_NONE, string $magic_database = "") {}
+ public function __construct(int $flags = FILEINFO_NONE, ?string $magic_database = null) {}
/**
* @param resource|null $context
@@ -29,7 +29,7 @@ class finfo
}
/** @return resource|false */
-function finfo_open(int $flags = FILEINFO_NONE, string $magic_database = "") {}
+function finfo_open(int $flags = FILEINFO_NONE, ?string $magic_database = null) {}
/**
* @param resource $finfo
diff --git a/ext/fileinfo/fileinfo_arginfo.h b/ext/fileinfo/fileinfo_arginfo.h
index 80850a6502..34b3698842 100644
--- a/ext/fileinfo/fileinfo_arginfo.h
+++ b/ext/fileinfo/fileinfo_arginfo.h
@@ -1,9 +1,9 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: be858509df27550b51d8a7a51a3629eceb6d0aa6 */
+ * Stub hash: 648085986695281bd5a8fb536d5ec6c2a9f8c6e8 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_open, 0, 0, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, magic_database, IS_STRING, 0, "\"\"")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, magic_database, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_finfo_close, 0, 1, _IS_BOOL, 0)