Skip to content

Commit 977b233

Browse files
kocsismatenikic
authored andcommitted
Add stubs for SAPIs
1 parent c1e792e commit 977b233

11 files changed

+81
-45
lines changed

sapi/cgi/cgi_main.c

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include "fopen_wrappers.h"
6464
#include "http_status_codes.h"
6565
#include "ext/standard/php_standard.h"
66+
#include "ext/standard/dl_arginfo.h"
6667
#include "ext/standard/url.h"
6768

6869
#ifdef PHP_WIN32
@@ -83,6 +84,7 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS;
8384
#include "php_getopt.h"
8485

8586
#include "fastcgi.h"
87+
#include "cgi_main_arginfo.h"
8688

8789
#if defined(PHP_WIN32) && defined(HAVE_OPENSSL)
8890
# include "openssl/applink.c"
@@ -1006,12 +1008,6 @@ static sapi_module_struct cgi_sapi_module = {
10061008
};
10071009
/* }}} */
10081010

1009-
/* {{{ arginfo ext/standard/dl.c */
1010-
ZEND_BEGIN_ARG_INFO(arginfo_dl, 0)
1011-
ZEND_ARG_INFO(0, extension_filename)
1012-
ZEND_END_ARG_INFO()
1013-
/* }}} */
1014-
10151011
static const zend_function_entry additional_functions[] = {
10161012
ZEND_FE(dl, arginfo_dl)
10171013
PHP_FE_END
@@ -1704,21 +1700,10 @@ PHP_FUNCTION(apache_response_headers) /* {{{ */
17041700
}
17051701
/* }}} */
17061702

1707-
ZEND_BEGIN_ARG_INFO(arginfo_no_args, 0)
1708-
ZEND_END_ARG_INFO()
1709-
1710-
static const zend_function_entry cgi_functions[] = {
1711-
PHP_FE(apache_child_terminate, arginfo_no_args)
1712-
PHP_FE(apache_request_headers, arginfo_no_args)
1713-
PHP_FE(apache_response_headers, arginfo_no_args)
1714-
PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args)
1715-
PHP_FE_END
1716-
};
1717-
17181703
static zend_module_entry cgi_module_entry = {
17191704
STANDARD_MODULE_HEADER,
17201705
"cgi-fcgi",
1721-
cgi_functions,
1706+
ext_functions,
17221707
PHP_MINIT(cgi),
17231708
PHP_MSHUTDOWN(cgi),
17241709
NULL,

sapi/cgi/cgi_main.stub.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
/** @generate-function-entries */
4+
5+
function apache_child_terminate(): void {}
6+
7+
function apache_request_headers(): array {}
8+
9+
/** @alias apache_request_headers */
10+
function getallheaders(): array {}
11+
12+
function apache_response_headers(): array {}

sapi/cgi/cgi_main_arginfo.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* This is a generated file, edit the .stub.php file instead.
2+
* Stub hash: ccb32ad91944af15fe1fcb44b97c28a79c1aad86 */
3+
4+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_child_terminate, 0, 0, IS_VOID, 0)
5+
ZEND_END_ARG_INFO()
6+
7+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_request_headers, 0, 0, IS_ARRAY, 0)
8+
ZEND_END_ARG_INFO()
9+
10+
#define arginfo_getallheaders arginfo_apache_request_headers
11+
12+
#define arginfo_apache_response_headers arginfo_apache_request_headers
13+
14+
15+
ZEND_FUNCTION(apache_child_terminate);
16+
ZEND_FUNCTION(apache_request_headers);
17+
ZEND_FUNCTION(apache_response_headers);
18+
19+
20+
static const zend_function_entry ext_functions[] = {
21+
ZEND_FE(apache_child_terminate, arginfo_apache_child_terminate)
22+
ZEND_FE(apache_request_headers, arginfo_apache_request_headers)
23+
ZEND_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
24+
ZEND_FE(apache_response_headers, arginfo_apache_response_headers)
25+
ZEND_FE_END
26+
};

sapi/cli/php_cli.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include "php_main.h"
5555
#include "fopen_wrappers.h"
5656
#include "ext/standard/php_standard.h"
57+
#include "ext/standard/dl_arginfo.h"
5758
#include "cli.h"
5859
#ifdef PHP_WIN32
5960
#include <io.h>
@@ -78,6 +79,7 @@
7879

7980
#include "ps_title.h"
8081
#include "php_cli_process_title.h"
82+
#include "php_cli_process_title_arginfo.h"
8183

8284
#ifndef PHP_WIN32
8385
# 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 = {
457459
};
458460
/* }}} */
459461

460-
/* {{{ arginfo ext/standard/dl.c */
461-
ZEND_BEGIN_ARG_INFO(arginfo_dl, 0)
462-
ZEND_ARG_INFO(0, extension_filename)
463-
ZEND_END_ARG_INFO()
464-
/* }}} */
465-
466462
static const zend_function_entry additional_functions[] = {
467463
ZEND_FE(dl, arginfo_dl)
468464
PHP_FE(cli_set_process_title, arginfo_cli_set_process_title)

sapi/cli/php_cli_process_title.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@
1717
#ifndef PHP_PS_TITLE_HEADER
1818
#define PHP_PS_TITLE_HEADER
1919

20-
ZEND_BEGIN_ARG_INFO(arginfo_cli_set_process_title, 0)
21-
ZEND_ARG_INFO(0, title)
22-
ZEND_END_ARG_INFO()
23-
24-
ZEND_BEGIN_ARG_INFO(arginfo_cli_get_process_title, 0)
25-
ZEND_END_ARG_INFO()
26-
2720
PHP_FUNCTION(cli_set_process_title);
2821
PHP_FUNCTION(cli_get_process_title);
2922

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
function cli_set_process_title(string $title): bool {}
4+
5+
function cli_get_process_title(): ?string {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* This is a generated file, edit the .stub.php file instead.
2+
* Stub hash: ee776e0c54fe4b66a98b3a0203af11c5f3082e38 */
3+
4+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cli_set_process_title, 0, 1, _IS_BOOL, 0)
5+
ZEND_ARG_TYPE_INFO(0, title, IS_STRING, 0)
6+
ZEND_END_ARG_INFO()
7+
8+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cli_get_process_title, 0, 0, IS_STRING, 1)
9+
ZEND_END_ARG_INFO()

sapi/cli/php_cli_server.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@
9191

9292
#include "php_http_parser.h"
9393
#include "php_cli_server.h"
94+
#include "php_cli_server_arginfo.h"
9495
#include "mime_type_map.h"
9596

9697
#include "php_cli_process_title.h"
98+
#include "php_cli_process_title_arginfo.h"
9799

98100
#define OUTPUT_NOT_CHECKED -1
99101
#define OUTPUT_IS_TTY 1
@@ -479,15 +481,12 @@ zend_module_entry cli_server_module_entry = {
479481
};
480482
/* }}} */
481483

482-
ZEND_BEGIN_ARG_INFO(arginfo_no_args, 0)
483-
ZEND_END_ARG_INFO()
484-
485484
const zend_function_entry server_additional_functions[] = {
486-
PHP_FE(cli_set_process_title, arginfo_cli_set_process_title)
487-
PHP_FE(cli_get_process_title, arginfo_cli_get_process_title)
488-
PHP_FE(apache_request_headers, arginfo_no_args)
489-
PHP_FE(apache_response_headers, arginfo_no_args)
490-
PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args)
485+
PHP_FE(cli_set_process_title, arginfo_cli_set_process_title)
486+
PHP_FE(cli_get_process_title, arginfo_cli_get_process_title)
487+
PHP_FE(apache_request_headers, arginfo_apache_request_headers)
488+
PHP_FE(apache_response_headers, arginfo_apache_response_headers)
489+
PHP_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
491490
PHP_FE_END
492491
};
493492

sapi/cli/php_cli_server.stub.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
function apache_request_headers(): array {}
4+
5+
function apache_response_headers(): array {}
6+
7+
function getallheaders(): array {}

sapi/cli/php_cli_server_arginfo.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* This is a generated file, edit the .stub.php file instead.
2+
* Stub hash: 60cd531d36a34fe7c51982e9ec40b45d2a2a4ce7 */
3+
4+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_request_headers, 0, 0, IS_ARRAY, 0)
5+
ZEND_END_ARG_INFO()
6+
7+
#define arginfo_apache_response_headers arginfo_apache_request_headers
8+
9+
#define arginfo_getallheaders arginfo_apache_request_headers

sapi/embed/php_embed.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "php_embed.h"
1818
#include "ext/standard/php_standard.h"
19+
#include "ext/standard/dl_arginfo.h"
1920

2021
#ifdef PHP_WIN32
2122
#include <io.h>
@@ -142,12 +143,6 @@ EMBED_SAPI_API sapi_module_struct php_embed_module = {
142143
};
143144
/* }}} */
144145

145-
/* {{{ arginfo ext/standard/dl.c */
146-
ZEND_BEGIN_ARG_INFO(arginfo_dl, 0)
147-
ZEND_ARG_INFO(0, extension_filename)
148-
ZEND_END_ARG_INFO()
149-
/* }}} */
150-
151146
static const zend_function_entry additional_functions[] = {
152147
ZEND_FE(dl, arginfo_dl)
153148
{NULL, NULL, NULL}

0 commit comments

Comments
 (0)