diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-03-25 11:53:06 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-07-10 14:20:18 +0200 |
commit | f328594072136b243c83ee8d70f81332f84e87da (patch) | |
tree | 2cdf7961f83f9d6a2a489d61407d838822ba24fe | |
parent | db43a93fc2c5b2f3f2e9eeca70803710afd59850 (diff) | |
download | php-git-f328594072136b243c83ee8d70f81332f84e87da.tar.gz |
Add stubs for SAPIs
Closes GH-5295.
-rw-r--r-- | sapi/cgi/cgi_main.c | 21 | ||||
-rw-r--r-- | sapi/cgi/cgi_main.stub.php | 12 | ||||
-rw-r--r-- | sapi/cgi/cgi_main_arginfo.h | 26 | ||||
-rw-r--r-- | sapi/cli/php_cli.c | 8 | ||||
-rw-r--r-- | sapi/cli/php_cli_process_title.h | 7 | ||||
-rw-r--r-- | sapi/cli/php_cli_process_title.stub.php | 5 | ||||
-rw-r--r-- | sapi/cli/php_cli_process_title_arginfo.h | 9 | ||||
-rw-r--r-- | sapi/cli/php_cli_server.c | 15 | ||||
-rw-r--r-- | sapi/cli/php_cli_server.stub.php | 7 | ||||
-rw-r--r-- | sapi/cli/php_cli_server_arginfo.h | 9 | ||||
-rw-r--r-- | sapi/embed/php_embed.c | 7 |
11 files changed, 81 insertions, 45 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index acbe69a7a9..8048085ebe 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -63,6 +63,7 @@ #include "fopen_wrappers.h" #include "http_status_codes.h" #include "ext/standard/php_standard.h" +#include "ext/standard/dl_arginfo.h" #include "ext/standard/url.h" #ifdef PHP_WIN32 @@ -83,6 +84,7 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS; #include "php_getopt.h" #include "fastcgi.h" +#include "cgi_main_arginfo.h" #if defined(PHP_WIN32) && defined(HAVE_OPENSSL) # include "openssl/applink.c" @@ -1006,12 +1008,6 @@ static sapi_module_struct cgi_sapi_module = { }; /* }}} */ -/* {{{ arginfo ext/standard/dl.c */ -ZEND_BEGIN_ARG_INFO(arginfo_dl, 0) - ZEND_ARG_INFO(0, extension_filename) -ZEND_END_ARG_INFO() -/* }}} */ - static const zend_function_entry additional_functions[] = { ZEND_FE(dl, arginfo_dl) PHP_FE_END @@ -1704,21 +1700,10 @@ PHP_FUNCTION(apache_response_headers) /* {{{ */ } /* }}} */ -ZEND_BEGIN_ARG_INFO(arginfo_no_args, 0) -ZEND_END_ARG_INFO() - -static const zend_function_entry cgi_functions[] = { - PHP_FE(apache_child_terminate, arginfo_no_args) - PHP_FE(apache_request_headers, arginfo_no_args) - PHP_FE(apache_response_headers, arginfo_no_args) - PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args) - PHP_FE_END -}; - static zend_module_entry cgi_module_entry = { STANDARD_MODULE_HEADER, "cgi-fcgi", - cgi_functions, + ext_functions, PHP_MINIT(cgi), PHP_MSHUTDOWN(cgi), NULL, diff --git a/sapi/cgi/cgi_main.stub.php b/sapi/cgi/cgi_main.stub.php new file mode 100644 index 0000000000..8273cffdc2 --- /dev/null +++ b/sapi/cgi/cgi_main.stub.php @@ -0,0 +1,12 @@ +<?php + +/** @generate-function-entries */ + +function apache_child_terminate(): void {} + +function apache_request_headers(): array {} + +/** @alias apache_request_headers */ +function getallheaders(): array {} + +function apache_response_headers(): array {} diff --git a/sapi/cgi/cgi_main_arginfo.h b/sapi/cgi/cgi_main_arginfo.h new file mode 100644 index 0000000000..2eaab875c4 --- /dev/null +++ b/sapi/cgi/cgi_main_arginfo.h @@ -0,0 +1,26 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: ccb32ad91944af15fe1fcb44b97c28a79c1aad86 */ + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_child_terminate, 0, 0, IS_VOID, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_request_headers, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_getallheaders arginfo_apache_request_headers + +#define arginfo_apache_response_headers arginfo_apache_request_headers + + +ZEND_FUNCTION(apache_child_terminate); +ZEND_FUNCTION(apache_request_headers); +ZEND_FUNCTION(apache_response_headers); + + +static const zend_function_entry ext_functions[] = { + ZEND_FE(apache_child_terminate, arginfo_apache_child_terminate) + ZEND_FE(apache_request_headers, arginfo_apache_request_headers) + ZEND_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders) + ZEND_FE(apache_response_headers, arginfo_apache_response_headers) + ZEND_FE_END +}; diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 9972b0f7a7..845312e9c6 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -54,6 +54,7 @@ #include "php_main.h" #include "fopen_wrappers.h" #include "ext/standard/php_standard.h" +#include "ext/standard/dl_arginfo.h" #include "cli.h" #ifdef PHP_WIN32 #include <io.h> @@ -78,6 +79,7 @@ #include "ps_title.h" #include "php_cli_process_title.h" +#include "php_cli_process_title_arginfo.h" #ifndef PHP_WIN32 # define php_select(m, r, w, e, t) select(m, r, w, e, t) @@ -457,12 +459,6 @@ static sapi_module_struct cli_sapi_module = { }; /* }}} */ -/* {{{ arginfo ext/standard/dl.c */ -ZEND_BEGIN_ARG_INFO(arginfo_dl, 0) - ZEND_ARG_INFO(0, extension_filename) -ZEND_END_ARG_INFO() -/* }}} */ - static const zend_function_entry additional_functions[] = { ZEND_FE(dl, arginfo_dl) PHP_FE(cli_set_process_title, arginfo_cli_set_process_title) diff --git a/sapi/cli/php_cli_process_title.h b/sapi/cli/php_cli_process_title.h index 74766491d7..c286f401c7 100644 --- a/sapi/cli/php_cli_process_title.h +++ b/sapi/cli/php_cli_process_title.h @@ -17,13 +17,6 @@ #ifndef PHP_PS_TITLE_HEADER #define PHP_PS_TITLE_HEADER -ZEND_BEGIN_ARG_INFO(arginfo_cli_set_process_title, 0) - ZEND_ARG_INFO(0, title) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_cli_get_process_title, 0) -ZEND_END_ARG_INFO() - PHP_FUNCTION(cli_set_process_title); PHP_FUNCTION(cli_get_process_title); diff --git a/sapi/cli/php_cli_process_title.stub.php b/sapi/cli/php_cli_process_title.stub.php new file mode 100644 index 0000000000..97dc8b2770 --- /dev/null +++ b/sapi/cli/php_cli_process_title.stub.php @@ -0,0 +1,5 @@ +<?php + +function cli_set_process_title(string $title): bool {} + +function cli_get_process_title(): ?string {} diff --git a/sapi/cli/php_cli_process_title_arginfo.h b/sapi/cli/php_cli_process_title_arginfo.h new file mode 100644 index 0000000000..9318640135 --- /dev/null +++ b/sapi/cli/php_cli_process_title_arginfo.h @@ -0,0 +1,9 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: ee776e0c54fe4b66a98b3a0203af11c5f3082e38 */ + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cli_set_process_title, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, title, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cli_get_process_title, 0, 0, IS_STRING, 1) +ZEND_END_ARG_INFO() diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 59929f21c9..b385f877e5 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -91,9 +91,11 @@ #include "php_http_parser.h" #include "php_cli_server.h" +#include "php_cli_server_arginfo.h" #include "mime_type_map.h" #include "php_cli_process_title.h" +#include "php_cli_process_title_arginfo.h" #define OUTPUT_NOT_CHECKED -1 #define OUTPUT_IS_TTY 1 @@ -479,15 +481,12 @@ zend_module_entry cli_server_module_entry = { }; /* }}} */ -ZEND_BEGIN_ARG_INFO(arginfo_no_args, 0) -ZEND_END_ARG_INFO() - const zend_function_entry server_additional_functions[] = { - PHP_FE(cli_set_process_title, arginfo_cli_set_process_title) - PHP_FE(cli_get_process_title, arginfo_cli_get_process_title) - PHP_FE(apache_request_headers, arginfo_no_args) - PHP_FE(apache_response_headers, arginfo_no_args) - PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args) + PHP_FE(cli_set_process_title, arginfo_cli_set_process_title) + PHP_FE(cli_get_process_title, arginfo_cli_get_process_title) + PHP_FE(apache_request_headers, arginfo_apache_request_headers) + PHP_FE(apache_response_headers, arginfo_apache_response_headers) + PHP_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders) PHP_FE_END }; diff --git a/sapi/cli/php_cli_server.stub.php b/sapi/cli/php_cli_server.stub.php new file mode 100644 index 0000000000..59706ba91f --- /dev/null +++ b/sapi/cli/php_cli_server.stub.php @@ -0,0 +1,7 @@ +<?php + +function apache_request_headers(): array {} + +function apache_response_headers(): array {} + +function getallheaders(): array {} diff --git a/sapi/cli/php_cli_server_arginfo.h b/sapi/cli/php_cli_server_arginfo.h new file mode 100644 index 0000000000..eb113aeaa0 --- /dev/null +++ b/sapi/cli/php_cli_server_arginfo.h @@ -0,0 +1,9 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 60cd531d36a34fe7c51982e9ec40b45d2a2a4ce7 */ + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_request_headers, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_apache_response_headers arginfo_apache_request_headers + +#define arginfo_getallheaders arginfo_apache_request_headers diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c index 184445e380..b510d5105e 100644 --- a/sapi/embed/php_embed.c +++ b/sapi/embed/php_embed.c @@ -16,6 +16,7 @@ #include "php_embed.h" #include "ext/standard/php_standard.h" +#include "ext/standard/dl_arginfo.h" #ifdef PHP_WIN32 #include <io.h> @@ -142,12 +143,6 @@ EMBED_SAPI_API sapi_module_struct php_embed_module = { }; /* }}} */ -/* {{{ arginfo ext/standard/dl.c */ -ZEND_BEGIN_ARG_INFO(arginfo_dl, 0) - ZEND_ARG_INFO(0, extension_filename) -ZEND_END_ARG_INFO() -/* }}} */ - static const zend_function_entry additional_functions[] = { ZEND_FE(dl, arginfo_dl) ZEND_FE_END |