Skip to content

Commit 1ce81b6

Browse files
authored
Generate optimizer func info from stubs for ext/standard - part 1 (#7413)
1 parent 8712fb5 commit 1ce81b6

File tree

4 files changed

+232
-100
lines changed

4 files changed

+232
-100
lines changed

Zend/Optimizer/zend_func_info.c

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -93,94 +93,6 @@ static const func_info_t old_func_infos[] = {
9393
F1("get_defined_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
9494

9595
/* ext/standard */
96-
F1("bin2hex", MAY_BE_STRING),
97-
F1("hex2bin", MAY_BE_FALSE | MAY_BE_STRING),
98-
#if HAVE_STRPTIME
99-
F1("strptime", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
100-
#endif
101-
F1("wordwrap", MAY_BE_STRING),
102-
F1("htmlspecialchars", MAY_BE_STRING),
103-
F1("htmlentities", MAY_BE_STRING),
104-
F1("get_html_translation_table", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
105-
F1("sha1", MAY_BE_STRING),
106-
F1("sha1_file", MAY_BE_FALSE | MAY_BE_STRING),
107-
F1("md5", MAY_BE_STRING),
108-
F1("md5_file", MAY_BE_FALSE | MAY_BE_STRING),
109-
F1("iptcparse", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
110-
F1("iptcembed", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
111-
F1("getimagesize", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
112-
F1("getimagesizefromstring", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
113-
F1("image_type_to_mime_type", MAY_BE_STRING),
114-
F1("image_type_to_extension", MAY_BE_FALSE | MAY_BE_STRING),
115-
F0("phpinfo", MAY_BE_TRUE),
116-
F1("phpversion", MAY_BE_FALSE | MAY_BE_STRING),
117-
F0("phpcredits", MAY_BE_TRUE),
118-
F1("php_sapi_name", MAY_BE_FALSE | MAY_BE_STRING),
119-
F1("php_uname", MAY_BE_STRING),
120-
F1("php_ini_scanned_files", MAY_BE_FALSE | MAY_BE_STRING),
121-
F1("php_ini_loaded_file", MAY_BE_FALSE | MAY_BE_STRING),
122-
F1("strtok", MAY_BE_FALSE | MAY_BE_STRING),
123-
F1("strrev", MAY_BE_STRING),
124-
F1("hebrev", MAY_BE_STRING),
125-
F1("basename", MAY_BE_STRING),
126-
F1("dirname", MAY_BE_STRING),
127-
F1("pathinfo", MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
128-
F1("stripslashes", MAY_BE_STRING),
129-
F1("stripcslashes", MAY_BE_STRING),
130-
F1("strstr", MAY_BE_FALSE | MAY_BE_STRING),
131-
F1("stristr", MAY_BE_FALSE | MAY_BE_STRING),
132-
F1("strrchr", MAY_BE_FALSE | MAY_BE_STRING),
133-
F1("str_shuffle", MAY_BE_STRING),
134-
F1("str_word_count", MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
135-
F1("str_split", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
136-
F1("strpbrk", MAY_BE_FALSE | MAY_BE_STRING),
137-
FN("substr_replace", MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
138-
F1("quotemeta", MAY_BE_STRING),
139-
F1("ucwords", MAY_BE_STRING),
140-
FN("str_replace", MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
141-
FN("str_ireplace", MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
142-
F1("str_repeat", MAY_BE_STRING),
143-
F1("count_chars", MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
144-
F1("chunk_split", MAY_BE_STRING),
145-
F1("strip_tags", MAY_BE_STRING),
146-
F1("explode", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
147-
F1("localeconv", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
148-
#if HAVE_NL_LANGINFO
149-
F1("nl_langinfo", MAY_BE_FALSE | MAY_BE_STRING),
150-
#endif
151-
F1("soundex", MAY_BE_STRING),
152-
F1("chr", MAY_BE_STRING),
153-
F1("str_getcsv", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
154-
F1("strchr", MAY_BE_FALSE | MAY_BE_STRING),
155-
F1("sprintf", MAY_BE_STRING),
156-
F1("vsprintf", MAY_BE_STRING),
157-
F1("sscanf", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
158-
F1("fscanf", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
159-
F1("parse_url", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_LONG),
160-
F1("urlencode", MAY_BE_STRING),
161-
F1("urldecode", MAY_BE_STRING),
162-
F1("rawurlencode", MAY_BE_STRING),
163-
F1("rawurldecode", MAY_BE_STRING),
164-
F1("http_build_query", MAY_BE_STRING),
165-
#if defined(HAVE_SYMLINK) || defined(PHP_WIN32)
166-
F1("readlink", MAY_BE_FALSE | MAY_BE_STRING),
167-
#endif
168-
F1("exec", MAY_BE_FALSE | MAY_BE_STRING),
169-
F1("system", MAY_BE_FALSE | MAY_BE_STRING),
170-
F1("escapeshellcmd", MAY_BE_STRING),
171-
F1("escapeshellarg", MAY_BE_STRING),
172-
F0("passthru", MAY_BE_NULL | MAY_BE_FALSE),
173-
F1("shell_exec", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
174-
#ifdef PHP_CAN_SUPPORT_PROC_OPEN
175-
F1("proc_get_status", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
176-
#endif
177-
F1("random_bytes", MAY_BE_STRING),
178-
#if HAVE_GETSERVBYPORT
179-
F1("getservbyport", MAY_BE_FALSE | MAY_BE_STRING),
180-
#endif
181-
#if HAVE_GETPROTOBYNUMBER
182-
F1("getprotobynumber", MAY_BE_FALSE | MAY_BE_STRING),
183-
#endif
18496
F1("base64_decode", MAY_BE_FALSE | MAY_BE_STRING),
18597
F1("base64_encode", MAY_BE_STRING),
18698
F1("password_hash", MAY_BE_STRING),

Zend/Optimizer/zend_func_infos.h

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,100 @@ static const func_info_t func_infos[] = {
101101
#if HAVE_NANOSLEEP
102102
F1("time_nanosleep", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_BOOL),
103103
#endif
104+
#if HAVE_GETSERVBYPORT
105+
F1("getservbyport", MAY_BE_STRING|MAY_BE_FALSE),
106+
#endif
107+
#if HAVE_GETPROTOBYNUMBER
108+
F1("getprotobynumber", MAY_BE_STRING|MAY_BE_FALSE),
109+
#endif
110+
#if HAVE_STRPTIME
111+
F1("strptime", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
112+
#endif
104113
#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
105114
F1("dns_get_record", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
106115
#endif
116+
F1("md5", MAY_BE_STRING),
117+
F1("md5_file", MAY_BE_STRING|MAY_BE_FALSE),
118+
F1("sha1", MAY_BE_STRING),
119+
F1("sha1_file", MAY_BE_STRING|MAY_BE_FALSE),
120+
F1("htmlspecialchars", MAY_BE_STRING),
121+
F1("htmlentities", MAY_BE_STRING),
122+
F1("get_html_translation_table", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING),
123+
F1("bin2hex", MAY_BE_STRING),
124+
F1("hex2bin", MAY_BE_STRING|MAY_BE_FALSE),
125+
#if HAVE_NL_LANGINFO
126+
F1("nl_langinfo", MAY_BE_STRING|MAY_BE_FALSE),
127+
#endif
128+
F1("wordwrap", MAY_BE_STRING),
129+
F1("explode", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
130+
F1("strtok", MAY_BE_STRING|MAY_BE_FALSE),
131+
F1("basename", MAY_BE_STRING),
132+
F1("dirname", MAY_BE_STRING),
133+
F1("pathinfo", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_STRING),
134+
F1("stristr", MAY_BE_STRING|MAY_BE_FALSE),
135+
F1("strstr", MAY_BE_STRING|MAY_BE_FALSE),
136+
F1("strrchr", MAY_BE_STRING|MAY_BE_FALSE),
137+
F1("chunk_split", MAY_BE_STRING),
138+
FN("substr_replace", MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING),
139+
F1("quotemeta", MAY_BE_STRING),
140+
F1("chr", MAY_BE_STRING),
141+
F1("ucwords", MAY_BE_STRING),
142+
F1("strrev", MAY_BE_STRING),
143+
F1("stripcslashes", MAY_BE_STRING),
144+
F1("stripslashes", MAY_BE_STRING),
145+
F1("str_replace", MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING),
146+
F1("str_ireplace", MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING),
147+
F1("hebrev", MAY_BE_STRING),
148+
F1("strip_tags", MAY_BE_STRING),
149+
F1("str_getcsv", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_NULL),
150+
F1("str_repeat", MAY_BE_STRING),
151+
F1("count_chars", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG|MAY_BE_STRING),
152+
F1("localeconv", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY),
153+
F1("sscanf", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ANY|MAY_BE_LONG|MAY_BE_NULL),
154+
F1("str_shuffle", MAY_BE_STRING),
155+
F1("str_word_count", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_LONG),
156+
F1("str_split", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
157+
F1("strpbrk", MAY_BE_STRING|MAY_BE_FALSE),
107158
FN("opendir", MAY_BE_RESOURCE|MAY_BE_FALSE),
159+
F1("exec", MAY_BE_STRING|MAY_BE_FALSE),
160+
F1("system", MAY_BE_STRING|MAY_BE_FALSE),
161+
F0("passthru", MAY_BE_FALSE|MAY_BE_NULL),
162+
F1("escapeshellcmd", MAY_BE_STRING),
163+
F1("escapeshellarg", MAY_BE_STRING),
164+
F1("shell_exec", MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL),
108165
F1("popen", MAY_BE_RESOURCE|MAY_BE_FALSE),
109166
F1("fopen", MAY_BE_RESOURCE|MAY_BE_FALSE),
167+
F1("fscanf", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ANY|MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_NULL),
110168
F1("tmpfile", MAY_BE_RESOURCE|MAY_BE_FALSE),
169+
F1("sprintf", MAY_BE_STRING),
170+
F1("vsprintf", MAY_BE_STRING),
111171
F1("fsockopen", MAY_BE_RESOURCE|MAY_BE_FALSE),
112172
FN("pfsockopen", MAY_BE_RESOURCE|MAY_BE_FALSE),
173+
F1("http_build_query", MAY_BE_STRING),
174+
F1("image_type_to_mime_type", MAY_BE_STRING),
175+
F1("image_type_to_extension", MAY_BE_STRING|MAY_BE_FALSE),
176+
F1("getimagesize", 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_FALSE),
177+
F1("getimagesizefromstring", 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_FALSE),
178+
F0("phpinfo", MAY_BE_TRUE),
179+
F1("phpversion", MAY_BE_STRING|MAY_BE_FALSE),
180+
F0("phpcredits", MAY_BE_TRUE),
181+
F1("php_sapi_name", MAY_BE_STRING|MAY_BE_FALSE),
182+
F1("php_uname", MAY_BE_STRING),
183+
F1("php_ini_scanned_files", MAY_BE_STRING|MAY_BE_FALSE),
184+
F1("php_ini_loaded_file", MAY_BE_STRING|MAY_BE_FALSE),
185+
F1("iptcembed", MAY_BE_STRING|MAY_BE_BOOL),
186+
F1("iptcparse", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
187+
#if defined(HAVE_SYMLINK) || defined(PHP_WIN32)
188+
F1("readlink", MAY_BE_STRING|MAY_BE_FALSE),
189+
#endif
113190
#if defined(PHP_CAN_SUPPORT_PROC_OPEN)
114191
F1("proc_open", MAY_BE_RESOURCE|MAY_BE_FALSE),
115192
#endif
193+
#if defined(PHP_CAN_SUPPORT_PROC_OPEN)
194+
F1("proc_get_status", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_FALSE|MAY_BE_ARRAY_OF_TRUE|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING),
195+
#endif
196+
F1("random_bytes", MAY_BE_STRING),
197+
F1("soundex", MAY_BE_STRING),
116198
F1("stream_context_create", MAY_BE_RESOURCE),
117199
FN("stream_context_get_default", MAY_BE_RESOURCE),
118200
FN("stream_context_set_default", MAY_BE_RESOURCE),
@@ -121,6 +203,11 @@ static const func_info_t func_infos[] = {
121203
F1("stream_socket_client", MAY_BE_RESOURCE|MAY_BE_FALSE),
122204
F1("stream_socket_server", MAY_BE_RESOURCE|MAY_BE_FALSE),
123205
F1("stream_socket_accept", MAY_BE_RESOURCE|MAY_BE_FALSE),
206+
F1("parse_url", MAY_BE_LONG|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_NULL|MAY_BE_FALSE),
207+
F1("urlencode", MAY_BE_STRING),
208+
F1("urldecode", MAY_BE_STRING),
209+
F1("rawurlencode", MAY_BE_STRING),
210+
F1("rawurldecode", MAY_BE_STRING),
124211
FN("zip_open", MAY_BE_RESOURCE|MAY_BE_LONG|MAY_BE_FALSE),
125212
FN("zip_read", MAY_BE_RESOURCE|MAY_BE_FALSE),
126213
F1("curl_copy_handle", MAY_BE_OBJECT|MAY_BE_FALSE),

0 commit comments

Comments
 (0)