Skip to content

Generate optimizer func info from stubs for various extensions #7409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 0 additions & 81 deletions Zend/Optimizer/zend_func_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,90 +344,9 @@ static const func_info_t old_func_infos[] = {
/* ext/preg */
F1("preg_grep", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),

/* ext/mbstring */
F1("mb_convert_case", MAY_BE_STRING),
F1("mb_strtoupper", MAY_BE_STRING),
F1("mb_strtolower", MAY_BE_STRING),
F1("mb_language", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
F1("mb_internal_encoding", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
F1("mb_http_input", MAY_BE_FALSE | MAY_BE_STRING| MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("mb_http_output", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
F1("mb_detect_order", MAY_BE_TRUE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("mb_substitute_character", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG | MAY_BE_STRING),
F1("mb_output_handler", MAY_BE_STRING),
F1("mb_preferred_mime_name", MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_strstr", MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_strrchr", MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_stristr", MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_strrichr", MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_substr", MAY_BE_STRING),
F1("mb_strcut", MAY_BE_STRING),
F1("mb_strimwidth", MAY_BE_STRING),
F1("mb_convert_encoding", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("mb_detect_encoding", MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_list_encodings", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("mb_encoding_aliases", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("mb_convert_kana", MAY_BE_STRING),
F1("mb_encode_mimeheader", MAY_BE_STRING),
F1("mb_decode_mimeheader", MAY_BE_STRING),
F1("mb_convert_variables", MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_encode_numericentity", MAY_BE_STRING),
F1("mb_decode_numericentity", MAY_BE_STRING),
F1("mb_get_info", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),

F1("mb_regex_encoding", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
F1("mb_regex_set_options", MAY_BE_STRING),
F1("mb_ereg_replace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_eregi_replace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_ereg_replace_callback", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_split", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("mb_ereg_search_pos", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
F1("mb_ereg_search_regs", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_STRING),
F1("mb_ereg_search_getregs", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_STRING),

/* ext/iconv */
F1("iconv", MAY_BE_FALSE | MAY_BE_STRING),
F1("iconv_get_encoding", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
F1("iconv_substr", MAY_BE_FALSE | MAY_BE_STRING),
F1("iconv_mime_encode", MAY_BE_FALSE | MAY_BE_STRING),
F1("iconv_mime_decode", MAY_BE_FALSE | MAY_BE_STRING),
F1("iconv_mime_decode_headers", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),

/* ext/xml */
F1("xml_error_string", MAY_BE_NULL | MAY_BE_STRING),
F1("xml_parser_get_option", MAY_BE_LONG | MAY_BE_STRING),
F1("utf8_encode", MAY_BE_STRING),
F1("utf8_decode", MAY_BE_STRING),

/* ext/zlib */
F1("gzfile", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("gzcompress", MAY_BE_FALSE | MAY_BE_STRING),
F1("gzuncompress", MAY_BE_FALSE | MAY_BE_STRING),
F1("gzdeflate", MAY_BE_FALSE | MAY_BE_STRING),
F1("gzinflate", MAY_BE_FALSE | MAY_BE_STRING),
F1("gzencode", MAY_BE_FALSE | MAY_BE_STRING),
F1("gzdecode", MAY_BE_FALSE | MAY_BE_STRING),
F1("zlib_encode", MAY_BE_FALSE | MAY_BE_STRING),
F1("zlib_decode", MAY_BE_FALSE | MAY_BE_STRING),
F1("zlib_get_coding_type", MAY_BE_FALSE | MAY_BE_STRING),
F1("ob_gzhandler", MAY_BE_FALSE | MAY_BE_STRING),

/* ext/hash */
F1("hash", MAY_BE_FALSE | MAY_BE_STRING),
F1("hash_file", MAY_BE_FALSE | MAY_BE_STRING),
F1("hash_hmac", MAY_BE_FALSE | MAY_BE_STRING),
F1("hash_hmac_algos", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("hash_hmac_file", MAY_BE_FALSE | MAY_BE_STRING),
F1("hash_hkdf", MAY_BE_STRING),
F1("hash_init", MAY_BE_OBJECT),
F1("hash_final", MAY_BE_STRING),
F1("hash_copy", MAY_BE_OBJECT),
F1("hash_algos", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("hash_pbkdf2", MAY_BE_STRING),
F1("mhash_keygen_s2k", MAY_BE_FALSE | MAY_BE_STRING),
F1("mhash_get_hash_name", MAY_BE_FALSE | MAY_BE_STRING),
F1("mhash", MAY_BE_FALSE | MAY_BE_FALSE | MAY_BE_STRING),

/* ext/filter */
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),

Expand Down
95 changes: 95 additions & 0 deletions Zend/Optimizer/zend_func_infos.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,32 @@ static const func_info_t func_infos[] = {
F1("spl_classes", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING),
F1("spl_object_hash", MAY_BE_STRING),
FN("socket_export_stream", MAY_BE_RESOURCE|MAY_BE_FALSE),
F1("iconv_substr", MAY_BE_STRING|MAY_BE_FALSE),
F1("iconv_mime_encode", MAY_BE_STRING|MAY_BE_FALSE),
F1("iconv_mime_decode", MAY_BE_STRING|MAY_BE_FALSE),
F1("iconv_mime_decode_headers", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
F1("iconv", MAY_BE_STRING|MAY_BE_FALSE),
F1("iconv_get_encoding", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_STRING|MAY_BE_FALSE),
F1("hash", MAY_BE_STRING|MAY_BE_FALSE),
F1("hash_file", MAY_BE_STRING|MAY_BE_FALSE),
F1("hash_hmac", MAY_BE_STRING|MAY_BE_FALSE),
F1("hash_hmac_file", MAY_BE_STRING|MAY_BE_FALSE),
F1("hash_init", MAY_BE_OBJECT),
F1("hash_final", MAY_BE_STRING),
F1("hash_copy", MAY_BE_OBJECT),
F1("hash_algos", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
F1("hash_hmac_algos", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
F1("hash_pbkdf2", MAY_BE_STRING),
F1("hash_hkdf", MAY_BE_STRING),
#if defined(PHP_MHASH_BC)
F1("mhash_get_hash_name", MAY_BE_STRING|MAY_BE_FALSE),
#endif
#if defined(PHP_MHASH_BC)
F1("mhash_keygen_s2k", MAY_BE_STRING|MAY_BE_FALSE),
#endif
#if defined(PHP_MHASH_BC)
F1("mhash", MAY_BE_STRING|MAY_BE_FALSE),
#endif
FN("dba_popen", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("dba_open", MAY_BE_RESOURCE|MAY_BE_FALSE),
F1("date", MAY_BE_STRING),
Expand Down Expand Up @@ -58,7 +84,20 @@ static const func_info_t func_infos[] = {
F1("date_sunset", MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_FALSE),
F1("date_sun_info", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_FALSE|MAY_BE_ARRAY_OF_TRUE|MAY_BE_ARRAY_OF_LONG),
FN("bzopen", MAY_BE_RESOURCE|MAY_BE_FALSE),
F1("ob_gzhandler", MAY_BE_STRING|MAY_BE_FALSE),
F1("zlib_get_coding_type", MAY_BE_STRING|MAY_BE_FALSE),
F1("gzfile", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
F1("gzopen", MAY_BE_RESOURCE|MAY_BE_FALSE),
F1("zlib_encode", MAY_BE_STRING|MAY_BE_FALSE),
F1("zlib_decode", MAY_BE_STRING|MAY_BE_FALSE),
F1("gzdeflate", MAY_BE_STRING|MAY_BE_FALSE),
F1("gzencode", MAY_BE_STRING|MAY_BE_FALSE),
F1("gzcompress", MAY_BE_STRING|MAY_BE_FALSE),
F1("gzinflate", MAY_BE_STRING|MAY_BE_FALSE),
F1("gzdecode", MAY_BE_STRING|MAY_BE_FALSE),
F1("gzuncompress", MAY_BE_STRING|MAY_BE_FALSE),
F1("xml_error_string", MAY_BE_STRING|MAY_BE_NULL),
F1("xml_parser_get_option", MAY_BE_STRING|MAY_BE_LONG),
#if HAVE_NANOSLEEP
F1("time_nanosleep", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_BOOL),
#endif
Expand Down Expand Up @@ -324,6 +363,62 @@ static const func_info_t func_infos[] = {
F1("bcpowmod", MAY_BE_STRING),
F1("bcpow", MAY_BE_STRING),
F1("bcsqrt", MAY_BE_STRING),
F1("mb_language", MAY_BE_STRING|MAY_BE_BOOL),
F1("mb_internal_encoding", MAY_BE_STRING|MAY_BE_BOOL),
F1("mb_http_input", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_STRING|MAY_BE_FALSE),
F1("mb_http_output", MAY_BE_STRING|MAY_BE_BOOL),
F1("mb_detect_order", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_TRUE),
F1("mb_substitute_character", MAY_BE_STRING|MAY_BE_LONG|MAY_BE_BOOL),
F1("mb_preferred_mime_name", MAY_BE_STRING|MAY_BE_FALSE),
F1("mb_output_handler", MAY_BE_STRING),
F1("mb_strstr", MAY_BE_STRING|MAY_BE_FALSE),
F1("mb_strrchr", MAY_BE_STRING|MAY_BE_FALSE),
F1("mb_stristr", MAY_BE_STRING|MAY_BE_FALSE),
F1("mb_strrichr", MAY_BE_STRING|MAY_BE_FALSE),
F1("mb_substr", MAY_BE_STRING),
F1("mb_strcut", MAY_BE_STRING),
F1("mb_strimwidth", MAY_BE_STRING),
F1("mb_convert_encoding", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_STRING|MAY_BE_FALSE),
F1("mb_convert_case", MAY_BE_STRING),
F1("mb_strtoupper", MAY_BE_STRING),
F1("mb_strtolower", MAY_BE_STRING),
F1("mb_detect_encoding", MAY_BE_STRING|MAY_BE_FALSE),
F1("mb_list_encodings", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
F1("mb_encoding_aliases", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
F1("mb_encode_mimeheader", MAY_BE_STRING),
F1("mb_decode_mimeheader", MAY_BE_STRING),
F1("mb_convert_kana", MAY_BE_STRING),
F1("mb_convert_variables", MAY_BE_STRING|MAY_BE_FALSE),
F1("mb_encode_numericentity", MAY_BE_STRING),
F1("mb_decode_numericentity", MAY_BE_STRING),
F1("mb_get_info", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE),
#if defined(HAVE_MBREGEX)
F1("mb_regex_encoding", MAY_BE_STRING|MAY_BE_BOOL),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_ereg_replace", MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_eregi_replace", MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_ereg_replace_callback", MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_split", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_ereg_search_pos", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG|MAY_BE_FALSE),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_ereg_search_regs", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_FALSE|MAY_BE_FALSE),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_ereg_search_getregs", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_FALSE|MAY_BE_FALSE),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_regex_set_options", MAY_BE_STRING),
#endif
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),
Expand Down
33 changes: 30 additions & 3 deletions ext/hash/hash.stub.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?php

/** @generate-class-entries */

/** @refcount 1 */
function hash(string $algo, string $data, bool $binary = false, array $options = []): string|false {}

/** @refcount 1 */
function hash_file(string $algo, string $filename, bool $binary = false, array $options = []): string|false {}

/** @refcount 1 */
function hash_hmac(string $algo, string $data, string $key, bool $binary = false): string|false {}

/** @refcount 1 */
function hash_hmac_file(string $algo, string $data, string $key, bool $binary = false): string|false {}

/** @refcount 1 */
function hash_init(string $algo, int $flags = 0, string $key = "", array $options = []): HashContext {}

function hash_update(HashContext $context, string $data): bool {}
Expand All @@ -19,34 +25,55 @@ function hash_update_stream(HashContext $context, $stream, int $length = -1): in
/** @param resource|null $stream_context */
function hash_update_file(HashContext $context, string $filename, $stream_context = null): bool {}

/** @refcount 1 */
function hash_final(HashContext $context, bool $binary = false): string {}

/** @refcount 1 */
function hash_copy(HashContext $context): HashContext {}

/**
* @return array<int, string>
* @refcount 1
*/
function hash_algos(): array {}

/**
* @return array<int, string>
* @refcount 1
*/
function hash_hmac_algos(): array {}

/** @refcount 1 */
function hash_pbkdf2(string $algo, string $password, string $salt, int $iterations, int $length = 0, bool $binary = false): string {}

function hash_equals(string $known_string, string $user_string): bool {}

/** @refcount 1 */
function hash_hkdf(string $algo, string $key, int $length = 0, string $info = "", string $salt = ""): string {}

#ifdef PHP_MHASH_BC
/** @deprecated */
function mhash_get_block_size(int $algo): int|false {}

/** @deprecated */
/**
* @refcount 1
* @deprecated
*/
function mhash_get_hash_name(int $algo): string|false {}

/** @deprecated */
/**
* @refcount 1
* @deprecated
*/
function mhash_keygen_s2k(int $algo, string $password, string $salt, int $length): string|false {}

/** @deprecated */
function mhash_count(): int {}

/** @deprecated */
/**
* @refcount 1
* @deprecated
*/
function mhash(int $algo, string $data, ?string $key = null): string|false {}
#endif

Expand Down
2 changes: 1 addition & 1 deletion ext/hash/hash_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 8c35168fb1c95e76c5c77fd0c0e8d295e13a0414 */
* Stub hash: d0ed07f608581a5700a10ec53a817ca788ef9638 */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
Expand Down
12 changes: 12 additions & 0 deletions ext/iconv/iconv.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,32 @@

function iconv_strlen(string $string, ?string $encoding = null): int|false {}

/** @refcount 1 */
function iconv_substr(string $string, int $offset, ?int $length = null, ?string $encoding = null): string|false {}

function iconv_strpos(string $haystack, string $needle, int $offset = 0, ?string $encoding = null): int|false {}

function iconv_strrpos(string $haystack, string $needle, ?string $encoding = null): int|false {}

/** @refcount 1 */
function iconv_mime_encode(string $field_name, string $field_value, array $options = []): string|false {}

/** @refcount 1 */
function iconv_mime_decode(string $string, int $mode = 0, ?string $encoding = null): string|false {}

/**
* @return array<string, string|array>|false
* @refcount 1
*/
function iconv_mime_decode_headers(string $headers, int $mode = 0, ?string $encoding = null): array|false {}

/** @refcount 1 */
function iconv(string $from_encoding, string $to_encoding, string $string): string|false {}

function iconv_set_encoding(string $type, string $encoding): bool {}

/**
* @return array<string, string>|string|false
* @refcount 1
*/
function iconv_get_encoding(string $type = "all"): array|string|false {}
2 changes: 1 addition & 1 deletion ext/iconv/iconv_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: c7b11a7cd853ede0ca7c5540995d8a7224d00da0 */
* Stub hash: c7198f92b39f7a15d242a74ed5f42036f858da2e */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_strlen, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
Expand Down
Loading