Skip to content

Commit c8cab92

Browse files
committed
Add stubs for SAPIs
1 parent add8c15 commit c8cab92

26 files changed

+273
-136
lines changed

ext/standard/dl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#endif
3939
#endif /* defined(HAVE_LIBDL) */
4040

41-
/* {{{ proto int dl(string extension_filename)
41+
/* {{{ proto bool dl(string extension_filename)
4242
Load a PHP extension at runtime */
4343
PHPAPI PHP_FUNCTION(dl)
4444
{

ext/standard/dl.stub.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
function dl(string $extension_filename): bool {}

ext/standard/dl_arginfo.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* This is a generated file, edit the .stub.php file instead. */
2+
3+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dl, 0, 1, _IS_BOOL, 0)
4+
ZEND_ARG_TYPE_INFO(0, extension_filename, IS_STRING, 0)
5+
ZEND_END_ARG_INFO()

sapi/apache2handler/php_functions.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -476,20 +476,6 @@ PHP_MINFO_FUNCTION(apache)
476476
}
477477
}
478478

479-
static const zend_function_entry apache_functions[] = {
480-
PHP_FE(apache_lookup_uri, arginfo_apache_lookup_uri)
481-
PHP_FE(virtual, arginfo_virtual)
482-
PHP_FE(apache_request_headers, arginfo_apache_request_headers)
483-
PHP_FE(apache_response_headers, arginfo_apache_response_headers)
484-
PHP_FE(apache_setenv, arginfo_apache_setenv)
485-
PHP_FE(apache_getenv, arginfo_apache_getenv)
486-
PHP_FE(apache_note, arginfo_apache_note)
487-
PHP_FE(apache_get_version, arginfo_apache_get_version)
488-
PHP_FE(apache_get_modules, arginfo_apache_get_modules)
489-
PHP_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
490-
{NULL, NULL, NULL}
491-
};
492-
493479
PHP_INI_BEGIN()
494480
STD_PHP_INI_ENTRY("xbithack", "0", PHP_INI_ALL, OnUpdateBool, xbithack, php_apache2_info_struct, php_apache2_info)
495481
STD_PHP_INI_ENTRY("engine", "1", PHP_INI_ALL, OnUpdateBool, engine, php_apache2_info_struct, php_apache2_info)
@@ -514,7 +500,7 @@ static PHP_MSHUTDOWN_FUNCTION(apache)
514500
zend_module_entry php_apache_module = {
515501
STANDARD_MODULE_HEADER,
516502
"apache2handler",
517-
apache_functions,
503+
ext_functions,
518504
PHP_MINIT(apache),
519505
PHP_MSHUTDOWN(apache),
520506
NULL,

sapi/apache2handler/php_functions.stub.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<?php
22

3+
/** @generate-function-entries */
4+
35
function apache_lookup_uri(string $filename): object|false {}
46

57
function virtual(string $uri): bool {}
68

79
function apache_request_headers(): array {}
810

11+
/** @alias apache_request_headers */
912
function getallheaders(): array {}
1013

1114
function apache_response_headers(): array {}

sapi/apache2handler/php_functions_arginfo.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,29 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_apache_get_version, 0, 0, MAY_BE
3535
ZEND_END_ARG_INFO()
3636

3737
#define arginfo_apache_get_modules arginfo_apache_request_headers
38+
39+
40+
ZEND_FUNCTION(apache_lookup_uri);
41+
ZEND_FUNCTION(virtual);
42+
ZEND_FUNCTION(apache_request_headers);
43+
ZEND_FUNCTION(apache_response_headers);
44+
ZEND_FUNCTION(apache_note);
45+
ZEND_FUNCTION(apache_setenv);
46+
ZEND_FUNCTION(apache_getenv);
47+
ZEND_FUNCTION(apache_get_version);
48+
ZEND_FUNCTION(apache_get_modules);
49+
50+
51+
static const zend_function_entry ext_functions[] = {
52+
ZEND_FE(apache_lookup_uri, arginfo_apache_lookup_uri)
53+
ZEND_FE(virtual, arginfo_virtual)
54+
ZEND_FE(apache_request_headers, arginfo_apache_request_headers)
55+
ZEND_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
56+
ZEND_FE(apache_response_headers, arginfo_apache_response_headers)
57+
ZEND_FE(apache_note, arginfo_apache_note)
58+
ZEND_FE(apache_setenv, arginfo_apache_setenv)
59+
ZEND_FE(apache_getenv, arginfo_apache_getenv)
60+
ZEND_FE(apache_get_version, arginfo_apache_get_version)
61+
ZEND_FE(apache_get_modules, arginfo_apache_get_modules)
62+
ZEND_FE_END
63+
};

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"
@@ -1004,12 +1006,6 @@ static sapi_module_struct cgi_sapi_module = {
10041006
};
10051007
/* }}} */
10061008

1007-
/* {{{ arginfo ext/standard/dl.c */
1008-
ZEND_BEGIN_ARG_INFO(arginfo_dl, 0)
1009-
ZEND_ARG_INFO(0, extension_filename)
1010-
ZEND_END_ARG_INFO()
1011-
/* }}} */
1012-
10131009
static const zend_function_entry additional_functions[] = {
10141010
ZEND_FE(dl, arginfo_dl)
10151011
PHP_FE_END
@@ -1707,21 +1703,10 @@ PHP_FUNCTION(apache_response_headers) /* {{{ */
17071703
}
17081704
/* }}} */
17091705

1710-
ZEND_BEGIN_ARG_INFO(arginfo_no_args, 0)
1711-
ZEND_END_ARG_INFO()
1712-
1713-
static const zend_function_entry cgi_functions[] = {
1714-
PHP_FE(apache_child_terminate, arginfo_no_args)
1715-
PHP_FE(apache_request_headers, arginfo_no_args)
1716-
PHP_FE(apache_response_headers, arginfo_no_args)
1717-
PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args)
1718-
PHP_FE_END
1719-
};
1720-
17211706
static zend_module_entry cgi_module_entry = {
17221707
STANDARD_MODULE_HEADER,
17231708
"cgi-fcgi",
1724-
cgi_functions,
1709+
ext_functions,
17251710
PHP_MINIT(cgi),
17261711
PHP_MSHUTDOWN(cgi),
17271712
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: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* This is a generated file, edit the .stub.php file instead. */
2+
3+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_child_terminate, 0, 0, IS_VOID, 0)
4+
ZEND_END_ARG_INFO()
5+
6+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_request_headers, 0, 0, IS_ARRAY, 0)
7+
ZEND_END_ARG_INFO()
8+
9+
#define arginfo_getallheaders arginfo_apache_request_headers
10+
11+
#define arginfo_apache_response_headers arginfo_apache_request_headers
12+
13+
14+
ZEND_FUNCTION(apache_child_terminate);
15+
ZEND_FUNCTION(apache_request_headers);
16+
ZEND_FUNCTION(apache_response_headers);
17+
18+
19+
static const zend_function_entry ext_functions[] = {
20+
ZEND_FE(apache_child_terminate, arginfo_apache_child_terminate)
21+
ZEND_FE(apache_request_headers, arginfo_apache_request_headers)
22+
ZEND_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
23+
ZEND_FE(apache_response_headers, arginfo_apache_response_headers)
24+
ZEND_FE_END
25+
};

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)
@@ -455,12 +457,6 @@ static sapi_module_struct cli_sapi_module = {
455457
};
456458
/* }}} */
457459

458-
/* {{{ arginfo ext/standard/dl.c */
459-
ZEND_BEGIN_ARG_INFO(arginfo_dl, 0)
460-
ZEND_ARG_INFO(0, extension_filename)
461-
ZEND_END_ARG_INFO()
462-
/* }}} */
463-
464460
static const zend_function_entry additional_functions[] = {
465461
ZEND_FE(dl, arginfo_dl)
466462
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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* This is a generated file, edit the .stub.php file instead. */
2+
3+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cli_set_process_title, 0, 1, _IS_BOOL, 0)
4+
ZEND_ARG_TYPE_INFO(0, title, IS_STRING, 0)
5+
ZEND_END_ARG_INFO()
6+
7+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cli_get_process_title, 0, 0, IS_STRING, 1)
8+
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
@@ -480,15 +482,12 @@ zend_module_entry cli_server_module_entry = {
480482
};
481483
/* }}} */
482484

483-
ZEND_BEGIN_ARG_INFO(arginfo_no_args, 0)
484-
ZEND_END_ARG_INFO()
485-
486485
const zend_function_entry server_additional_functions[] = {
487-
PHP_FE(cli_set_process_title, arginfo_cli_set_process_title)
488-
PHP_FE(cli_get_process_title, arginfo_cli_get_process_title)
489-
PHP_FE(apache_request_headers, arginfo_no_args)
490-
PHP_FE(apache_response_headers, arginfo_no_args)
491-
PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args)
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_apache_request_headers)
489+
PHP_FE(apache_response_headers, arginfo_apache_response_headers)
490+
PHP_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
492491
PHP_FE_END
493492
};
494493

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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* This is a generated file, edit the .stub.php file instead. */
2+
3+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_request_headers, 0, 0, IS_ARRAY, 0)
4+
ZEND_END_ARG_INFO()
5+
6+
#define arginfo_apache_response_headers arginfo_apache_request_headers
7+
8+
#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}

sapi/fpm/fpm/fpm_main.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS;
8282

8383
#include <php_config.h>
8484
#include "fpm.h"
85+
#include "fpm_main_arginfo.h"
8586
#include "fpm_request.h"
8687
#include "fpm_status.h"
8788
#include "fpm_signals.h"
@@ -1457,9 +1458,6 @@ static PHP_MINFO_FUNCTION(cgi)
14571458
}
14581459
/* }}} */
14591460

1460-
ZEND_BEGIN_ARG_INFO(cgi_fcgi_sapi_no_arginfo, 0)
1461-
ZEND_END_ARG_INFO()
1462-
14631461
PHP_FUNCTION(fastcgi_finish_request) /* {{{ */
14641462
{
14651463
fcgi_request *request = (fcgi_request*) SG(server_context);
@@ -1510,18 +1508,10 @@ PHP_FUNCTION(fpm_get_status) /* {{{ */
15101508
}
15111509
/* }}} */
15121510

1513-
static const zend_function_entry cgi_fcgi_sapi_functions[] = {
1514-
PHP_FE(fastcgi_finish_request, cgi_fcgi_sapi_no_arginfo)
1515-
PHP_FE(fpm_get_status, cgi_fcgi_sapi_no_arginfo)
1516-
PHP_FE(apache_request_headers, cgi_fcgi_sapi_no_arginfo)
1517-
PHP_FALIAS(getallheaders, apache_request_headers, cgi_fcgi_sapi_no_arginfo)
1518-
PHP_FE_END
1519-
};
1520-
15211511
static zend_module_entry cgi_module_entry = {
15221512
STANDARD_MODULE_HEADER,
15231513
"cgi-fcgi",
1524-
cgi_fcgi_sapi_functions,
1514+
ext_functions,
15251515
PHP_MINIT(cgi),
15261516
PHP_MSHUTDOWN(cgi),
15271517
NULL,

sapi/fpm/fpm/fpm_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 fastcgi_finish_request(): bool {}
6+
7+
function apache_request_headers(): array {}
8+
9+
/** @alias apache_request_headers */
10+
function getallheaders(): array {}
11+
12+
function fpm_get_status(): array|false {}

sapi/fpm/fpm/fpm_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+
3+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_fastcgi_finish_request, 0, 0, _IS_BOOL, 0)
4+
ZEND_END_ARG_INFO()
5+
6+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_request_headers, 0, 0, IS_ARRAY, 0)
7+
ZEND_END_ARG_INFO()
8+
9+
#define arginfo_getallheaders arginfo_apache_request_headers
10+
11+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fpm_get_status, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
12+
ZEND_END_ARG_INFO()
13+
14+
15+
ZEND_FUNCTION(fastcgi_finish_request);
16+
ZEND_FUNCTION(apache_request_headers);
17+
ZEND_FUNCTION(fpm_get_status);
18+
19+
20+
static const zend_function_entry ext_functions[] = {
21+
ZEND_FE(fastcgi_finish_request, arginfo_fastcgi_finish_request)
22+
ZEND_FE(apache_request_headers, arginfo_apache_request_headers)
23+
ZEND_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
24+
ZEND_FE(fpm_get_status, arginfo_fpm_get_status)
25+
ZEND_FE_END
26+
};

0 commit comments

Comments
 (0)