Generate optimizer func info from stubs for a few extensions - part 2 (#7401)

ext/bcmath, ext/fileinfo, ext/filter, ext/gettext, ext/session
This commit is contained in:
Máté Kocsis 2021-08-25 15:29:46 +02:00 committed by GitHub
parent 1c9f8eb7b9
commit 50f31829b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 90 additions and 56 deletions

View File

@ -595,15 +595,6 @@ static const func_info_t old_func_infos[] = {
F1("sodium_crypto_aead_chacha20poly1305_ietf_keygen", MAY_BE_STRING),
F1("sodium_crypto_aead_xchacha20poly1305_ietf_keygen", MAY_BE_STRING),
/* ext/session */
F1("session_get_cookie_params", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
F1("session_name", MAY_BE_FALSE | MAY_BE_STRING),
F1("session_module_name", MAY_BE_FALSE | MAY_BE_STRING),
F1("session_save_path", MAY_BE_FALSE | MAY_BE_STRING),
F1("session_create_id", MAY_BE_FALSE | MAY_BE_STRING),
F1("session_cache_limiter", MAY_BE_FALSE | MAY_BE_STRING),
F1("session_encode", MAY_BE_FALSE | MAY_BE_STRING),
/* ext/pgsql */
F1("pg_dbname", MAY_BE_STRING),
F1("pg_options", MAY_BE_STRING),
@ -649,48 +640,8 @@ static const func_info_t old_func_infos[] = {
F1("pg_delete", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
F1("pg_select", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
/* ext/bcmath */
F1("bcadd", MAY_BE_STRING),
F1("bcsub", MAY_BE_STRING),
F1("bcmul", MAY_BE_STRING),
F1("bcdiv", MAY_BE_STRING),
F1("bcmod", MAY_BE_STRING),
F1("bcpowmod", MAY_BE_STRING),
F1("bcpow", MAY_BE_STRING),
F1("bcsqrt", MAY_BE_STRING),
/* ext/exif */
F1("exif_tagname", MAY_BE_FALSE | MAY_BE_STRING),
F1("exif_read_data", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
F1("exif_thumbnail", MAY_BE_FALSE | MAY_BE_STRING),
/* ext/filter */
F1("filter_input_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("filter_var_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
F1("filter_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
/* ext/gettext */
F1("textdomain", MAY_BE_STRING),
F1("gettext", MAY_BE_STRING),
F1("_", MAY_BE_STRING),
F1("dgettext", MAY_BE_STRING),
F1("dcgettext", MAY_BE_STRING),
F1("bindtextdomain", MAY_BE_FALSE | MAY_BE_STRING),
#if HAVE_NGETTEXT
F1("ngettext", MAY_BE_STRING),
#endif
#if HAVE_DNGETTEXT
F1("dcngettext", MAY_BE_STRING),
#endif
#if HAVE_BIND_TEXTDOMAIN_CODESET
F1("bind_textdomain_codeset", MAY_BE_FALSE | MAY_BE_STRING),
#endif
/* ext/fileinfo */
F1("finfo_open", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("finfo_file", MAY_BE_FALSE | MAY_BE_STRING),
F1("finfo_buffer", MAY_BE_FALSE | MAY_BE_STRING),
F1("mime_content_type", MAY_BE_FALSE | MAY_BE_STRING),
/* ext/gd */
F1("gd_info", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE),

View File

@ -56,6 +56,10 @@ static const func_info_t func_infos[] = {
FN("zip_read", MAY_BE_RESOURCE|MAY_BE_FALSE),
F1("json_encode", MAY_BE_STRING|MAY_BE_FALSE),
F1("json_last_error_msg", MAY_BE_STRING),
F1("finfo_open", MAY_BE_OBJECT|MAY_BE_FALSE),
F1("finfo_file", MAY_BE_STRING|MAY_BE_FALSE),
F1("finfo_buffer", MAY_BE_STRING|MAY_BE_FALSE),
F1("mime_content_type", MAY_BE_STRING|MAY_BE_FALSE),
FN("oci_new_connect", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("oci_connect", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("oci_pconnect", MAY_BE_RESOURCE|MAY_BE_FALSE),
@ -88,6 +92,43 @@ static const func_info_t func_infos[] = {
#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
FN("odbc_columnprivileges", MAY_BE_RESOURCE|MAY_BE_FALSE),
#endif
F1("textdomain", MAY_BE_STRING),
F1("gettext", MAY_BE_STRING),
F1("dgettext", MAY_BE_STRING),
F1("dcgettext", MAY_BE_STRING),
F1("bindtextdomain", MAY_BE_STRING|MAY_BE_FALSE),
#if defined(HAVE_NGETTEXT)
F1("ngettext", MAY_BE_STRING),
#endif
#if defined(HAVE_DNGETTEXT)
F1("dngettext", MAY_BE_STRING),
#endif
#if defined(HAVE_DCNGETTEXT)
F1("dcngettext", MAY_BE_STRING),
#endif
#if defined(HAVE_BIND_TEXTDOMAIN_CODESET)
F1("bind_textdomain_codeset", MAY_BE_STRING|MAY_BE_FALSE),
#endif
F1("exif_tagname", MAY_BE_STRING|MAY_BE_FALSE),
F1("exif_read_data", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
F1("exif_thumbnail", MAY_BE_STRING|MAY_BE_FALSE),
F1("pg_socket", MAY_BE_RESOURCE|MAY_BE_FALSE),
F1("filter_input_array", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE|MAY_BE_NULL),
F1("filter_list", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
FN("pcntl_signal_get_handler", MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_OBJECT|MAY_BE_LONG),
F1("bcadd", MAY_BE_STRING),
F1("bcsub", MAY_BE_STRING),
F1("bcmul", MAY_BE_STRING),
F1("bcdiv", MAY_BE_STRING),
F1("bcmod", MAY_BE_STRING),
F1("bcpowmod", MAY_BE_STRING),
F1("bcpow", MAY_BE_STRING),
F1("bcsqrt", MAY_BE_STRING),
F1("session_name", MAY_BE_STRING|MAY_BE_FALSE),
F1("session_module_name", MAY_BE_STRING|MAY_BE_FALSE),
F1("session_save_path", MAY_BE_STRING|MAY_BE_FALSE),
F1("session_create_id", MAY_BE_STRING|MAY_BE_FALSE),
F1("session_encode", MAY_BE_STRING|MAY_BE_FALSE),
F1("session_get_cookie_params", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY),
F1("session_cache_limiter", MAY_BE_STRING|MAY_BE_FALSE),
};

View File

@ -2,20 +2,28 @@
/** @generate-class-entries */
/** @refcount 1 */
function bcadd(string $num1, string $num2, ?int $scale = null): string {}
/** @refcount 1 */
function bcsub(string $num1, string $num2, ?int $scale = null): string {}
/** @refcount 1 */
function bcmul(string $num1, string $num2, ?int $scale = null): string {}
/** @refcount 1 */
function bcdiv(string $num1, string $num2, ?int $scale = null): string {}
/** @refcount 1 */
function bcmod(string $num1, string $num2, ?int $scale = null): string {}
/** @refcount 1 */
function bcpowmod(string $num, string $exponent, string $modulus, ?int $scale = null): string {}
/** @refcount 1 */
function bcpow(string $num, string $exponent, ?int $scale = null): string {}
/** @refcount 1 */
function bcsqrt(string $num, ?int $scale = null): string {}
function bccomp(string $num1, string $num2, ?int $scale = null): int {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 6a16fed65c0e488e65c43e7df3bd1744e9349cc7 */
* Stub hash: f28dafc2a279f5421cd0d0e668fde0032e996ebc */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcadd, 0, 2, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, num1, IS_STRING, 0)

View File

@ -2,9 +2,14 @@
/** @generate-class-entries */
/** @refcount 1 */
function exif_tagname(int $index): string|false {}
/** @param resource|string $file */
/**
* @param resource|string $file
* @return array<string, mixed>|false
* @refcount 1
*/
function exif_read_data($file, ?string $required_sections = null, bool $as_arrays = false, bool $read_thumbnail = false): array|false {}
/**
@ -12,6 +17,7 @@ function exif_read_data($file, ?string $required_sections = null, bool $as_array
* @param int $width
* @param int $height
* @param int $image_type
* @refcount 1
*/
function exif_thumbnail($file, &$width = null, &$height = null, &$image_type = null): string|false {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 466379e651a4944e15a0163eabfb29b7d988d747 */
* Stub hash: 22c3c385b3edc3e91b123e4c953d8836bf8eb7f3 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_exif_tagname, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)

View File

@ -29,6 +29,7 @@ class finfo
public function set_flags(int $flags) {} // TODO make return type void
}
/** @refcount 1 */
function finfo_open(int $flags = FILEINFO_NONE, ?string $magic_database = null): finfo|false {}
function finfo_close(finfo $finfo): bool {}
@ -37,15 +38,18 @@ function finfo_set_flags(finfo $finfo, int $flags): bool {} // TODO make return
/**
* @param resource|null $context
* @refcount 1
*/
function finfo_file(finfo $finfo, string $filename, int $flags = FILEINFO_NONE, $context = null): string|false {}
/**
* @param resource|null $context
* @refcount 1
*/
function finfo_buffer(finfo $finfo, string $string, int $flags = FILEINFO_NONE, $context = null): string|false {}
/**
* @param resource|string $filename
* @refcount 1
*/
function mime_content_type($filename): string|false {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: edb72bf1a82a6b2e027caa91c6668c27e36b9c34 */
* Stub hash: 162664644202bf582b09be897e46c9bdc4d66a5b */
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_finfo_open, 0, 0, finfo, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")

View File

@ -8,10 +8,15 @@ function filter_input(int $type, string $var_name, int $filter = FILTER_DEFAULT,
function filter_var(mixed $value, int $filter = FILTER_DEFAULT, array|int $options = 0): mixed {}
/** @refcount 1 */
function filter_input_array(int $type, array|int $options = FILTER_DEFAULT, bool $add_empty = true): array|false|null {}
function filter_var_array(array $array, array|int $options = FILTER_DEFAULT, bool $add_empty = true): array|false|null {}
/**
* @return array<int, string>
* @refcount 1
*/
function filter_list(): array {}
function filter_id(string $name): int|false {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 6285ac516fc8972995db91f1c8bf0c171c8fe594 */
* Stub hash: 28ff4549a3e25c103a172624b8e25c6cd1912379 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_filter_has_var, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, input_type, IS_LONG, 0)

View File

@ -2,31 +2,40 @@
/** @generate-class-entries */
/** @refcount 1 */
function textdomain(?string $domain): string {}
/** @refcount 1 */
function gettext(string $message): string {}
/** @alias gettext */
function _(string $message): string {}
/** @refcount 1 */
function dgettext(string $domain, string $message): string {}
/** @refcount 1 */
function dcgettext(string $domain, string $message, int $category): string {}
/** @refcount 1 */
function bindtextdomain(string $domain, ?string $directory): string|false {}
#ifdef HAVE_NGETTEXT
/** @refcount 1 */
function ngettext(string $singular, string $plural, int $count): string {}
#endif
#ifdef HAVE_DNGETTEXT
/** @refcount 1 */
function dngettext(string $domain, string $singular, string $plural, int $count): string {}
#endif
#ifdef HAVE_DCNGETTEXT
/** @refcount 1 */
function dcngettext(string $domain, string $singular, string $plural, int $count, int $category): string {}
#endif
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
/** @refcount 1 */
function bind_textdomain_codeset(string $domain, ?string $codeset): string|false {}
#endif

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: bc0c8a6b95afdacad81cc19b5aeb727a58f0cb38 */
* Stub hash: 864b3389d4f99b0d7302ae399544e6fb9fb80b7e */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_textdomain, 0, 1, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 1)

View File

@ -2,20 +2,25 @@
/** @generate-class-entries */
/** @refcount 1 */
function session_name(?string $name = null): string|false {}
/** @refcount 1 */
function session_module_name(?string $module = null): string|false {}
/** @refcount 1 */
function session_save_path(?string $path = null): string|false {}
function session_id(?string $id = null): string|false {}
/** @refcount 1 */
function session_create_id(string $prefix = ""): string|false {}
function session_regenerate_id(bool $delete_old_session = false): bool {}
function session_decode(string $data): bool {}
/** @refcount 1 */
function session_encode(): string|false {}
function session_destroy(): bool {}
@ -24,6 +29,10 @@ function session_unset(): bool {}
function session_gc(): int|false {}
/**
* @return array<string, mixed>
* @refcount 1
*/
function session_get_cookie_params(): array {}
function session_write_close(): bool {}
@ -55,6 +64,7 @@ function session_set_save_handler(
callable $update_timestamp = UNKNOWN
): bool {}
/** @refcount 1 */
function session_cache_limiter(?string $value = null): string|false {}
function session_cache_expire(?int $value = null): int|false {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 6838259167ac6edd5a4f6adec9fddf838f301337 */
* Stub hash: 27358fb446398ea651c62abb29c81589a37df028 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_name, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, name, IS_STRING, 1, "null")