Skip to content

Commit 50f3182

Browse files
authored
Generate optimizer func info from stubs for a few extensions - part 2 (#7401)
ext/bcmath, ext/fileinfo, ext/filter, ext/gettext, ext/session
1 parent 1c9f8eb commit 50f3182

14 files changed

+90
-56
lines changed

Zend/Optimizer/zend_func_info.c

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -595,15 +595,6 @@ static const func_info_t old_func_infos[] = {
595595
F1("sodium_crypto_aead_chacha20poly1305_ietf_keygen", MAY_BE_STRING),
596596
F1("sodium_crypto_aead_xchacha20poly1305_ietf_keygen", MAY_BE_STRING),
597597

598-
/* ext/session */
599-
F1("session_get_cookie_params", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
600-
F1("session_name", MAY_BE_FALSE | MAY_BE_STRING),
601-
F1("session_module_name", MAY_BE_FALSE | MAY_BE_STRING),
602-
F1("session_save_path", MAY_BE_FALSE | MAY_BE_STRING),
603-
F1("session_create_id", MAY_BE_FALSE | MAY_BE_STRING),
604-
F1("session_cache_limiter", MAY_BE_FALSE | MAY_BE_STRING),
605-
F1("session_encode", MAY_BE_FALSE | MAY_BE_STRING),
606-
607598
/* ext/pgsql */
608599
F1("pg_dbname", MAY_BE_STRING),
609600
F1("pg_options", MAY_BE_STRING),
@@ -649,48 +640,8 @@ static const func_info_t old_func_infos[] = {
649640
F1("pg_delete", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
650641
F1("pg_select", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
651642

652-
/* ext/bcmath */
653-
F1("bcadd", MAY_BE_STRING),
654-
F1("bcsub", MAY_BE_STRING),
655-
F1("bcmul", MAY_BE_STRING),
656-
F1("bcdiv", MAY_BE_STRING),
657-
F1("bcmod", MAY_BE_STRING),
658-
F1("bcpowmod", MAY_BE_STRING),
659-
F1("bcpow", MAY_BE_STRING),
660-
F1("bcsqrt", MAY_BE_STRING),
661-
662-
/* ext/exif */
663-
F1("exif_tagname", MAY_BE_FALSE | MAY_BE_STRING),
664-
F1("exif_read_data", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
665-
F1("exif_thumbnail", MAY_BE_FALSE | MAY_BE_STRING),
666-
667643
/* ext/filter */
668-
F1("filter_input_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
669644
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),
670-
F1("filter_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
671-
672-
/* ext/gettext */
673-
F1("textdomain", MAY_BE_STRING),
674-
F1("gettext", MAY_BE_STRING),
675-
F1("_", MAY_BE_STRING),
676-
F1("dgettext", MAY_BE_STRING),
677-
F1("dcgettext", MAY_BE_STRING),
678-
F1("bindtextdomain", MAY_BE_FALSE | MAY_BE_STRING),
679-
#if HAVE_NGETTEXT
680-
F1("ngettext", MAY_BE_STRING),
681-
#endif
682-
#if HAVE_DNGETTEXT
683-
F1("dcngettext", MAY_BE_STRING),
684-
#endif
685-
#if HAVE_BIND_TEXTDOMAIN_CODESET
686-
F1("bind_textdomain_codeset", MAY_BE_FALSE | MAY_BE_STRING),
687-
#endif
688-
689-
/* ext/fileinfo */
690-
F1("finfo_open", MAY_BE_FALSE | MAY_BE_OBJECT),
691-
F1("finfo_file", MAY_BE_FALSE | MAY_BE_STRING),
692-
F1("finfo_buffer", MAY_BE_FALSE | MAY_BE_STRING),
693-
F1("mime_content_type", MAY_BE_FALSE | MAY_BE_STRING),
694645

695646
/* ext/gd */
696647
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),

Zend/Optimizer/zend_func_infos.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ static const func_info_t func_infos[] = {
5656
FN("zip_read", MAY_BE_RESOURCE|MAY_BE_FALSE),
5757
F1("json_encode", MAY_BE_STRING|MAY_BE_FALSE),
5858
F1("json_last_error_msg", MAY_BE_STRING),
59+
F1("finfo_open", MAY_BE_OBJECT|MAY_BE_FALSE),
60+
F1("finfo_file", MAY_BE_STRING|MAY_BE_FALSE),
61+
F1("finfo_buffer", MAY_BE_STRING|MAY_BE_FALSE),
62+
F1("mime_content_type", MAY_BE_STRING|MAY_BE_FALSE),
5963
FN("oci_new_connect", MAY_BE_RESOURCE|MAY_BE_FALSE),
6064
FN("oci_connect", MAY_BE_RESOURCE|MAY_BE_FALSE),
6165
FN("oci_pconnect", MAY_BE_RESOURCE|MAY_BE_FALSE),
@@ -88,6 +92,43 @@ static const func_info_t func_infos[] = {
8892
#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
8993
FN("odbc_columnprivileges", MAY_BE_RESOURCE|MAY_BE_FALSE),
9094
#endif
95+
F1("textdomain", MAY_BE_STRING),
96+
F1("gettext", MAY_BE_STRING),
97+
F1("dgettext", MAY_BE_STRING),
98+
F1("dcgettext", MAY_BE_STRING),
99+
F1("bindtextdomain", MAY_BE_STRING|MAY_BE_FALSE),
100+
#if defined(HAVE_NGETTEXT)
101+
F1("ngettext", MAY_BE_STRING),
102+
#endif
103+
#if defined(HAVE_DNGETTEXT)
104+
F1("dngettext", MAY_BE_STRING),
105+
#endif
106+
#if defined(HAVE_DCNGETTEXT)
107+
F1("dcngettext", MAY_BE_STRING),
108+
#endif
109+
#if defined(HAVE_BIND_TEXTDOMAIN_CODESET)
110+
F1("bind_textdomain_codeset", MAY_BE_STRING|MAY_BE_FALSE),
111+
#endif
112+
F1("exif_tagname", MAY_BE_STRING|MAY_BE_FALSE),
113+
F1("exif_read_data", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
114+
F1("exif_thumbnail", MAY_BE_STRING|MAY_BE_FALSE),
91115
F1("pg_socket", MAY_BE_RESOURCE|MAY_BE_FALSE),
116+
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),
117+
F1("filter_list", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
92118
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),
119+
F1("bcadd", MAY_BE_STRING),
120+
F1("bcsub", MAY_BE_STRING),
121+
F1("bcmul", MAY_BE_STRING),
122+
F1("bcdiv", MAY_BE_STRING),
123+
F1("bcmod", MAY_BE_STRING),
124+
F1("bcpowmod", MAY_BE_STRING),
125+
F1("bcpow", MAY_BE_STRING),
126+
F1("bcsqrt", MAY_BE_STRING),
127+
F1("session_name", MAY_BE_STRING|MAY_BE_FALSE),
128+
F1("session_module_name", MAY_BE_STRING|MAY_BE_FALSE),
129+
F1("session_save_path", MAY_BE_STRING|MAY_BE_FALSE),
130+
F1("session_create_id", MAY_BE_STRING|MAY_BE_FALSE),
131+
F1("session_encode", MAY_BE_STRING|MAY_BE_FALSE),
132+
F1("session_get_cookie_params", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY),
133+
F1("session_cache_limiter", MAY_BE_STRING|MAY_BE_FALSE),
93134
};

ext/bcmath/bcmath.stub.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,28 @@
22

33
/** @generate-class-entries */
44

5+
/** @refcount 1 */
56
function bcadd(string $num1, string $num2, ?int $scale = null): string {}
67

8+
/** @refcount 1 */
79
function bcsub(string $num1, string $num2, ?int $scale = null): string {}
810

11+
/** @refcount 1 */
912
function bcmul(string $num1, string $num2, ?int $scale = null): string {}
1013

14+
/** @refcount 1 */
1115
function bcdiv(string $num1, string $num2, ?int $scale = null): string {}
1216

17+
/** @refcount 1 */
1318
function bcmod(string $num1, string $num2, ?int $scale = null): string {}
1419

20+
/** @refcount 1 */
1521
function bcpowmod(string $num, string $exponent, string $modulus, ?int $scale = null): string {}
1622

23+
/** @refcount 1 */
1724
function bcpow(string $num, string $exponent, ?int $scale = null): string {}
1825

26+
/** @refcount 1 */
1927
function bcsqrt(string $num, ?int $scale = null): string {}
2028

2129
function bccomp(string $num1, string $num2, ?int $scale = null): int {}

ext/bcmath/bcmath_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 6a16fed65c0e488e65c43e7df3bd1744e9349cc7 */
2+
* Stub hash: f28dafc2a279f5421cd0d0e668fde0032e996ebc */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcadd, 0, 2, IS_STRING, 0)
55
ZEND_ARG_TYPE_INFO(0, num1, IS_STRING, 0)

ext/exif/exif.stub.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,22 @@
22

33
/** @generate-class-entries */
44

5+
/** @refcount 1 */
56
function exif_tagname(int $index): string|false {}
67

7-
/** @param resource|string $file */
8+
/**
9+
* @param resource|string $file
10+
* @return array<string, mixed>|false
11+
* @refcount 1
12+
*/
813
function exif_read_data($file, ?string $required_sections = null, bool $as_arrays = false, bool $read_thumbnail = false): array|false {}
914

1015
/**
1116
* @param resource|string $file
1217
* @param int $width
1318
* @param int $height
1419
* @param int $image_type
20+
* @refcount 1
1521
*/
1622
function exif_thumbnail($file, &$width = null, &$height = null, &$image_type = null): string|false {}
1723

ext/exif/exif_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 466379e651a4944e15a0163eabfb29b7d988d747 */
2+
* Stub hash: 22c3c385b3edc3e91b123e4c953d8836bf8eb7f3 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_exif_tagname, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)

ext/fileinfo/fileinfo.stub.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public function buffer(string $string, int $flags = FILEINFO_NONE, $context = nu
2929
public function set_flags(int $flags) {} // TODO make return type void
3030
}
3131

32+
/** @refcount 1 */
3233
function finfo_open(int $flags = FILEINFO_NONE, ?string $magic_database = null): finfo|false {}
3334

3435
function finfo_close(finfo $finfo): bool {}
@@ -37,15 +38,18 @@ function finfo_set_flags(finfo $finfo, int $flags): bool {} // TODO make return
3738

3839
/**
3940
* @param resource|null $context
41+
* @refcount 1
4042
*/
4143
function finfo_file(finfo $finfo, string $filename, int $flags = FILEINFO_NONE, $context = null): string|false {}
4244

4345
/**
4446
* @param resource|null $context
47+
* @refcount 1
4548
*/
4649
function finfo_buffer(finfo $finfo, string $string, int $flags = FILEINFO_NONE, $context = null): string|false {}
4750

4851
/**
4952
* @param resource|string $filename
53+
* @refcount 1
5054
*/
5155
function mime_content_type($filename): string|false {}

ext/fileinfo/fileinfo_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: edb72bf1a82a6b2e027caa91c6668c27e36b9c34 */
2+
* Stub hash: 162664644202bf582b09be897e46c9bdc4d66a5b */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_finfo_open, 0, 0, finfo, MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")

ext/filter/filter.stub.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@ function filter_input(int $type, string $var_name, int $filter = FILTER_DEFAULT,
88

99
function filter_var(mixed $value, int $filter = FILTER_DEFAULT, array|int $options = 0): mixed {}
1010

11+
/** @refcount 1 */
1112
function filter_input_array(int $type, array|int $options = FILTER_DEFAULT, bool $add_empty = true): array|false|null {}
1213

1314
function filter_var_array(array $array, array|int $options = FILTER_DEFAULT, bool $add_empty = true): array|false|null {}
1415

16+
/**
17+
* @return array<int, string>
18+
* @refcount 1
19+
*/
1520
function filter_list(): array {}
1621

1722
function filter_id(string $name): int|false {}

ext/filter/filter_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 6285ac516fc8972995db91f1c8bf0c171c8fe594 */
2+
* Stub hash: 28ff4549a3e25c103a172624b8e25c6cd1912379 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_filter_has_var, 0, 2, _IS_BOOL, 0)
55
ZEND_ARG_TYPE_INFO(0, input_type, IS_LONG, 0)

ext/gettext/gettext.stub.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,40 @@
22

33
/** @generate-class-entries */
44

5+
/** @refcount 1 */
56
function textdomain(?string $domain): string {}
67

8+
/** @refcount 1 */
79
function gettext(string $message): string {}
810

911
/** @alias gettext */
1012
function _(string $message): string {}
1113

14+
/** @refcount 1 */
1215
function dgettext(string $domain, string $message): string {}
1316

17+
/** @refcount 1 */
1418
function dcgettext(string $domain, string $message, int $category): string {}
1519

20+
/** @refcount 1 */
1621
function bindtextdomain(string $domain, ?string $directory): string|false {}
1722

1823
#ifdef HAVE_NGETTEXT
24+
/** @refcount 1 */
1925
function ngettext(string $singular, string $plural, int $count): string {}
2026
#endif
2127

2228
#ifdef HAVE_DNGETTEXT
29+
/** @refcount 1 */
2330
function dngettext(string $domain, string $singular, string $plural, int $count): string {}
2431
#endif
2532

2633
#ifdef HAVE_DCNGETTEXT
34+
/** @refcount 1 */
2735
function dcngettext(string $domain, string $singular, string $plural, int $count, int $category): string {}
2836
#endif
2937

3038
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
39+
/** @refcount 1 */
3140
function bind_textdomain_codeset(string $domain, ?string $codeset): string|false {}
3241
#endif

ext/gettext/gettext_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: bc0c8a6b95afdacad81cc19b5aeb727a58f0cb38 */
2+
* Stub hash: 864b3389d4f99b0d7302ae399544e6fb9fb80b7e */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_textdomain, 0, 1, IS_STRING, 0)
55
ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 1)

ext/session/session.stub.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,25 @@
22

33
/** @generate-class-entries */
44

5+
/** @refcount 1 */
56
function session_name(?string $name = null): string|false {}
67

8+
/** @refcount 1 */
79
function session_module_name(?string $module = null): string|false {}
810

11+
/** @refcount 1 */
912
function session_save_path(?string $path = null): string|false {}
1013

1114
function session_id(?string $id = null): string|false {}
1215

16+
/** @refcount 1 */
1317
function session_create_id(string $prefix = ""): string|false {}
1418

1519
function session_regenerate_id(bool $delete_old_session = false): bool {}
1620

1721
function session_decode(string $data): bool {}
1822

23+
/** @refcount 1 */
1924
function session_encode(): string|false {}
2025

2126
function session_destroy(): bool {}
@@ -24,6 +29,10 @@ function session_unset(): bool {}
2429

2530
function session_gc(): int|false {}
2631

32+
/**
33+
* @return array<string, mixed>
34+
* @refcount 1
35+
*/
2736
function session_get_cookie_params(): array {}
2837

2938
function session_write_close(): bool {}
@@ -55,6 +64,7 @@ function session_set_save_handler(
5564
callable $update_timestamp = UNKNOWN
5665
): bool {}
5766

67+
/** @refcount 1 */
5868
function session_cache_limiter(?string $value = null): string|false {}
5969

6070
function session_cache_expire(?int $value = null): int|false {}

ext/session/session_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 6838259167ac6edd5a4f6adec9fddf838f301337 */
2+
* Stub hash: 27358fb446398ea651c62abb29c81589a37df028 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_name, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, name, IS_STRING, 1, "null")

0 commit comments

Comments
 (0)