Improve gen_stub.php

Closes GH-5350
Add support for generating deprecated function entries, as well as forward declaration
of function aliases.
This commit is contained in:
Máté Kocsis 2020-04-04 21:26:46 +02:00
parent 7c3078737f
commit 610815c0ce
No known key found for this signature in database
GPG key ID: FD055E41728BF310
10 changed files with 303 additions and 160 deletions

View file

@ -304,6 +304,8 @@ class FuncInfo {
public $className; public $className;
/** @var ?string */ /** @var ?string */
public $alias; public $alias;
/** @var bool */
public $isDeprecated;
/** @var ArgInfo[] */ /** @var ArgInfo[] */
public $args; public $args;
/** @var ReturnInfo */ /** @var ReturnInfo */
@ -314,12 +316,13 @@ class FuncInfo {
public $cond; public $cond;
public function __construct( public function __construct(
string $name, ?string $className, ?string $alias, array $args, ReturnInfo $return, string $name, ?string $className, ?string $alias, bool $isDeprecated, array $args, ReturnInfo $return,
int $numRequiredArgs, ?string $cond int $numRequiredArgs, ?string $cond
) { ) {
$this->name = $name; $this->name = $name;
$this->className = $className; $this->className = $className;
$this->alias = $alias; $this->alias = $alias;
$this->isDeprecated = $isDeprecated;
$this->args = $args; $this->args = $args;
$this->return = $return; $this->return = $return;
$this->numRequiredArgs = $numRequiredArgs; $this->numRequiredArgs = $numRequiredArgs;
@ -419,7 +422,7 @@ function parseDocComment(DocComment $comment): array {
$commentText = substr($comment->getText(), 2, -2); $commentText = substr($comment->getText(), 2, -2);
$tags = []; $tags = [];
foreach (explode("\n", $commentText) as $commentLine) { foreach (explode("\n", $commentText) as $commentLine) {
$regex = '/^\*\s*@([a-z-]+)(?:\s+(.+))$/'; $regex = '/^\*\s*@([a-z-]+)(?:\s+(.+))?$/';
if (preg_match($regex, trim($commentLine), $matches, PREG_UNMATCHED_AS_NULL)) { if (preg_match($regex, trim($commentLine), $matches, PREG_UNMATCHED_AS_NULL)) {
$tags[] = new DocCommentTag($matches[1], $matches[2]); $tags[] = new DocCommentTag($matches[1], $matches[2]);
} }
@ -434,6 +437,7 @@ function parseFunctionLike(
$comment = $func->getDocComment(); $comment = $func->getDocComment();
$paramMeta = []; $paramMeta = [];
$alias = null; $alias = null;
$isDeprecated = false;
$haveDocReturnType = false; $haveDocReturnType = false;
if ($comment) { if ($comment) {
@ -447,6 +451,8 @@ function parseFunctionLike(
$paramMeta[$varName]['preferRef'] = true; $paramMeta[$varName]['preferRef'] = true;
} else if ($tag->name === 'alias') { } else if ($tag->name === 'alias') {
$alias = $tag->getValue(); $alias = $tag->getValue();
} else if ($tag->name === 'deprecated') {
$isDeprecated = true;
} else if ($tag->name === 'return') { } else if ($tag->name === 'return') {
$haveDocReturnType = true; $haveDocReturnType = true;
} }
@ -507,7 +513,7 @@ function parseFunctionLike(
$return = new ReturnInfo( $return = new ReturnInfo(
$func->returnsByRef(), $func->returnsByRef(),
$returnType ? Type::fromNode($returnType) : null); $returnType ? Type::fromNode($returnType) : null);
return new FuncInfo($name, $className, $alias, $args, $return, $numRequiredArgs, $cond); return new FuncInfo($name, $className, $alias, $isDeprecated, $args, $return, $numRequiredArgs, $cond);
} }
function handlePreprocessorConditions(array &$conds, Stmt $stmt): ?string { function handlePreprocessorConditions(array &$conds, Stmt $stmt): ?string {
@ -737,6 +743,7 @@ function generateCodeWithConditions(
} }
function generateArgInfoCode(FileInfo $fileInfo): string { function generateArgInfoCode(FileInfo $fileInfo): string {
$generatedDeclarations = [];
$funcInfos = $fileInfo->funcInfos; $funcInfos = $fileInfo->funcInfos;
$code = "/* This is a generated file, edit the .stub.php file instead. */\n"; $code = "/* This is a generated file, edit the .stub.php file instead. */\n";
@ -761,12 +768,15 @@ function generateArgInfoCode(FileInfo $fileInfo): string {
if ($fileInfo->generateFunctionEntries) { if ($fileInfo->generateFunctionEntries) {
$code .= "\n\n"; $code .= "\n\n";
$code .= generateCodeWithConditions($fileInfo->funcInfos, "", function(FuncInfo $funcInfo) { $code .= generateCodeWithConditions($funcInfos, "", function(FuncInfo $funcInfo) use (&$generatedDeclarations) {
if ($funcInfo->alias) { $name = $funcInfo->alias ?? $funcInfo->name;
$key = "$name|$funcInfo->cond";
if (isset($generatedDeclarations[$key])) {
return null; return null;
} }
return "ZEND_FUNCTION($funcInfo->name);\n"; $generatedDeclarations[$key] = true;
return "ZEND_FUNCTION($name);\n";
}); });
$code .= "\n\nstatic const zend_function_entry ext_functions[] = {\n"; $code .= "\n\nstatic const zend_function_entry ext_functions[] = {\n";
@ -776,9 +786,13 @@ function generateArgInfoCode(FileInfo $fileInfo): string {
"\tZEND_FALIAS(%s, %s, %s)\n", "\tZEND_FALIAS(%s, %s, %s)\n",
$funcInfo->name, $funcInfo->alias, $funcInfo->getArgInfoName() $funcInfo->name, $funcInfo->alias, $funcInfo->getArgInfoName()
); );
} else {
return sprintf("\tZEND_FE(%s, %s)\n", $funcInfo->name, $funcInfo->getArgInfoName());
} }
if ($funcInfo->isDeprecated) {
return sprintf("\tZEND_DEP_FE(%s, %s)\n", $funcInfo->name, $funcInfo->getArgInfoName());
}
return sprintf("\tZEND_FE(%s, %s)\n", $funcInfo->name, $funcInfo->getArgInfoName());
}); });
$code .= "\tZEND_FE_END\n"; $code .= "\tZEND_FE_END\n";
$code .= "};\n"; $code .= "};\n";

View file

@ -25,7 +25,6 @@
#if HAVE_BZ2 #if HAVE_BZ2
/* PHP Includes */ /* PHP Includes */
#include "ext/standard/file.h"
#include "ext/standard/info.h" #include "ext/standard/info.h"
#include "ext/standard/php_string.h" #include "ext/standard/php_string.h"
#include "main/php_network.h" #include "main/php_network.h"
@ -41,32 +40,11 @@
static PHP_MINIT_FUNCTION(bz2); static PHP_MINIT_FUNCTION(bz2);
static PHP_MSHUTDOWN_FUNCTION(bz2); static PHP_MSHUTDOWN_FUNCTION(bz2);
static PHP_MINFO_FUNCTION(bz2); static PHP_MINFO_FUNCTION(bz2);
static PHP_FUNCTION(bzopen);
static PHP_FUNCTION(bzread);
static PHP_FUNCTION(bzerrno);
static PHP_FUNCTION(bzerrstr);
static PHP_FUNCTION(bzerror);
static PHP_FUNCTION(bzcompress);
static PHP_FUNCTION(bzdecompress);
static const zend_function_entry bz2_functions[] = {
PHP_FE(bzopen, arginfo_bzopen)
PHP_FE(bzread, arginfo_bzread)
PHP_FALIAS(bzwrite, fwrite, arginfo_bzwrite)
PHP_FALIAS(bzflush, fflush, arginfo_bzflush)
PHP_FALIAS(bzclose, fclose, arginfo_bzclose)
PHP_FE(bzerrno, arginfo_bzerrno)
PHP_FE(bzerrstr, arginfo_bzerrstr)
PHP_FE(bzerror, arginfo_bzerror)
PHP_FE(bzcompress, arginfo_bzcompress)
PHP_FE(bzdecompress, arginfo_bzdecompress)
PHP_FE_END
};
zend_module_entry bz2_module_entry = { zend_module_entry bz2_module_entry = {
STANDARD_MODULE_HEADER, STANDARD_MODULE_HEADER,
"bz2", "bz2",
bz2_functions, ext_functions,
PHP_MINIT(bz2), PHP_MINIT(bz2),
PHP_MSHUTDOWN(bz2), PHP_MSHUTDOWN(bz2),
NULL, NULL,
@ -325,7 +303,7 @@ static PHP_MINFO_FUNCTION(bz2)
/* {{{ proto string bzread(resource bz[, int length]) /* {{{ proto string bzread(resource bz[, int length])
Reads up to length bytes from a BZip2 stream, or 1024 bytes if length is not specified */ Reads up to length bytes from a BZip2 stream, or 1024 bytes if length is not specified */
static PHP_FUNCTION(bzread) PHP_FUNCTION(bzread)
{ {
zval *bz; zval *bz;
zend_long len = 1024; zend_long len = 1024;
@ -353,7 +331,7 @@ static PHP_FUNCTION(bzread)
/* {{{ proto resource bzopen(string|int file|fp, string mode) /* {{{ proto resource bzopen(string|int file|fp, string mode)
Opens a new BZip2 stream */ Opens a new BZip2 stream */
static PHP_FUNCTION(bzopen) PHP_FUNCTION(bzopen)
{ {
zval *file; /* The file to open */ zval *file; /* The file to open */
char *mode; /* The mode to open the stream with */ char *mode; /* The mode to open the stream with */
@ -444,7 +422,7 @@ static PHP_FUNCTION(bzopen)
/* {{{ proto int bzerrno(resource bz) /* {{{ proto int bzerrno(resource bz)
Returns the error number */ Returns the error number */
static PHP_FUNCTION(bzerrno) PHP_FUNCTION(bzerrno)
{ {
php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRNO); php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRNO);
} }
@ -452,7 +430,7 @@ static PHP_FUNCTION(bzerrno)
/* {{{ proto string bzerrstr(resource bz) /* {{{ proto string bzerrstr(resource bz)
Returns the error string */ Returns the error string */
static PHP_FUNCTION(bzerrstr) PHP_FUNCTION(bzerrstr)
{ {
php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRSTR); php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRSTR);
} }
@ -460,7 +438,7 @@ static PHP_FUNCTION(bzerrstr)
/* {{{ proto array bzerror(resource bz) /* {{{ proto array bzerror(resource bz)
Returns the error number and error string in an associative array */ Returns the error number and error string in an associative array */
static PHP_FUNCTION(bzerror) PHP_FUNCTION(bzerror)
{ {
php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRBOTH); php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRBOTH);
} }
@ -468,7 +446,7 @@ static PHP_FUNCTION(bzerror)
/* {{{ proto string bzcompress(string source [, int blocksize100k [, int workfactor]]) /* {{{ proto string bzcompress(string source [, int blocksize100k [, int workfactor]])
Compresses a string into BZip2 encoded data */ Compresses a string into BZip2 encoded data */
static PHP_FUNCTION(bzcompress) PHP_FUNCTION(bzcompress)
{ {
char *source; /* Source data to compress */ char *source; /* Source data to compress */
zend_long zblock_size = 0; /* Optional block size to use */ zend_long zblock_size = 0; /* Optional block size to use */
@ -519,7 +497,7 @@ static PHP_FUNCTION(bzcompress)
/* {{{ proto string bzdecompress(string source [, int small]) /* {{{ proto string bzdecompress(string source [, int small])
Decompresses BZip2 compressed data */ Decompresses BZip2 compressed data */
static PHP_FUNCTION(bzdecompress) PHP_FUNCTION(bzdecompress)
{ {
char *source; char *source;
zend_string *dest; zend_string *dest;

View file

@ -1,5 +1,7 @@
<?php <?php
/** @generate-function-entries */
/** /**
* @param string|resource $file * @param string|resource $file
* @return resource|false * @return resource|false

View file

@ -44,3 +44,30 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bzdecompress, 0, 1, MAY_BE_STRIN
ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, small, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, small, IS_LONG, 0)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_FUNCTION(bzopen);
ZEND_FUNCTION(bzread);
ZEND_FUNCTION(fwrite);
ZEND_FUNCTION(fflush);
ZEND_FUNCTION(fclose);
ZEND_FUNCTION(bzerrno);
ZEND_FUNCTION(bzerrstr);
ZEND_FUNCTION(bzerror);
ZEND_FUNCTION(bzcompress);
ZEND_FUNCTION(bzdecompress);
static const zend_function_entry ext_functions[] = {
ZEND_FE(bzopen, arginfo_bzopen)
ZEND_FE(bzread, arginfo_bzread)
ZEND_FALIAS(bzwrite, fwrite, arginfo_bzwrite)
ZEND_FALIAS(bzflush, fflush, arginfo_bzflush)
ZEND_FALIAS(bzclose, fclose, arginfo_bzclose)
ZEND_FE(bzerrno, arginfo_bzerrno)
ZEND_FE(bzerrstr, arginfo_bzerrstr)
ZEND_FE(bzerror, arginfo_bzerror)
ZEND_FE(bzcompress, arginfo_bzcompress)
ZEND_FE(bzdecompress, arginfo_bzdecompress)
ZEND_FE_END
};

View file

@ -4374,116 +4374,10 @@ PHP_FUNCTION(ldap_exop_refresh)
/* }}} */ /* }}} */
#endif #endif
/* }}} */
/*
This is just a small subset of the functionality provided by the LDAP library. All the
operations are synchronous. Referrals are not handled automatically.
*/
/* {{{ ldap_functions[]
*/
static const zend_function_entry ldap_functions[] = {
PHP_FE(ldap_connect, arginfo_ldap_connect)
PHP_FALIAS(ldap_close, ldap_unbind, arginfo_ldap_close)
PHP_FE(ldap_bind, arginfo_ldap_bind)
PHP_FE(ldap_bind_ext, arginfo_ldap_bind_ext)
#ifdef HAVE_LDAP_SASL
PHP_FE(ldap_sasl_bind, arginfo_ldap_sasl_bind)
#endif
PHP_FE(ldap_unbind, arginfo_ldap_unbind)
PHP_FE(ldap_read, arginfo_ldap_read)
PHP_FE(ldap_list, arginfo_ldap_list)
PHP_FE(ldap_search, arginfo_ldap_search)
PHP_FE(ldap_free_result, arginfo_ldap_free_result)
PHP_FE(ldap_count_entries, arginfo_ldap_count_entries)
PHP_FE(ldap_first_entry, arginfo_ldap_first_entry)
PHP_FE(ldap_next_entry, arginfo_ldap_next_entry)
PHP_FE(ldap_get_entries, arginfo_ldap_get_entries)
PHP_FE(ldap_first_attribute, arginfo_ldap_first_attribute)
PHP_FE(ldap_next_attribute, arginfo_ldap_next_attribute)
PHP_FE(ldap_get_attributes, arginfo_ldap_get_attributes)
PHP_FALIAS(ldap_get_values, ldap_get_values_len, arginfo_ldap_get_values)
PHP_FE(ldap_get_values_len, arginfo_ldap_get_values_len)
PHP_FE(ldap_get_dn, arginfo_ldap_get_dn)
PHP_FE(ldap_explode_dn, arginfo_ldap_explode_dn)
PHP_FE(ldap_dn2ufn, arginfo_ldap_dn2ufn)
PHP_FE(ldap_add, arginfo_ldap_add)
PHP_FE(ldap_add_ext, arginfo_ldap_add_ext)
PHP_FE(ldap_delete, arginfo_ldap_delete)
PHP_FE(ldap_delete_ext, arginfo_ldap_delete_ext)
PHP_FE(ldap_modify_batch, arginfo_ldap_modify_batch)
PHP_FALIAS(ldap_modify, ldap_mod_replace, arginfo_ldap_modify)
/* additional functions for attribute based modifications, Gerrit Thomson */
PHP_FE(ldap_mod_add, arginfo_ldap_mod_add)
PHP_FE(ldap_mod_add_ext, arginfo_ldap_mod_add_ext)
PHP_FE(ldap_mod_replace, arginfo_ldap_mod_replace)
PHP_FE(ldap_mod_replace_ext, arginfo_ldap_mod_replace_ext)
PHP_FE(ldap_mod_del, arginfo_ldap_mod_del)
PHP_FE(ldap_mod_del_ext, arginfo_ldap_mod_del_ext)
/* end gjt mod */
PHP_FE(ldap_errno, arginfo_ldap_errno)
PHP_FE(ldap_err2str, arginfo_ldap_err2str)
PHP_FE(ldap_error, arginfo_ldap_error)
PHP_FE(ldap_compare, arginfo_ldap_compare)
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
PHP_FE(ldap_rename, arginfo_ldap_rename)
PHP_FE(ldap_rename_ext, arginfo_ldap_rename_ext)
PHP_FE(ldap_get_option, arginfo_ldap_get_option)
PHP_FE(ldap_set_option, arginfo_ldap_set_option)
PHP_FE(ldap_first_reference, arginfo_ldap_first_reference)
PHP_FE(ldap_next_reference, arginfo_ldap_next_reference)
#ifdef HAVE_LDAP_PARSE_REFERENCE
PHP_FE(ldap_parse_reference, arginfo_ldap_parse_reference)
#endif
#ifdef HAVE_LDAP_PARSE_RESULT
PHP_FE(ldap_parse_result, arginfo_ldap_parse_result)
#endif
#ifdef HAVE_LDAP_START_TLS_S
PHP_FE(ldap_start_tls, arginfo_ldap_start_tls)
#endif
#ifdef HAVE_LDAP_EXTENDED_OPERATION_S
PHP_FE(ldap_exop, arginfo_ldap_exop)
#endif
#ifdef HAVE_LDAP_PASSWD
PHP_FE(ldap_exop_passwd, arginfo_ldap_exop_passwd)
#endif
#ifdef HAVE_LDAP_WHOAMI_S
PHP_FE(ldap_exop_whoami, arginfo_ldap_exop_whoami)
#endif
#ifdef HAVE_LDAP_REFRESH_S
PHP_FE(ldap_exop_refresh, arginfo_ldap_exop_refresh)
#endif
#ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT
PHP_FE(ldap_parse_exop, arginfo_ldap_parse_exop)
#endif
#endif
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
PHP_FE(ldap_set_rebind_proc, arginfo_ldap_set_rebind_proc)
#endif
PHP_FE(ldap_escape, arginfo_ldap_escape)
#ifdef STR_TRANSLATION
PHP_FE(ldap_t61_to_8859, arginfo_ldap_t61_to_8859)
PHP_FE(ldap_8859_to_t61, arginfo_ldap_8859_to_t61)
#endif
#ifdef LDAP_CONTROL_PAGEDRESULTS
PHP_DEP_FE(ldap_control_paged_result, arginfo_ldap_control_paged_result)
PHP_DEP_FE(ldap_control_paged_result_response, arginfo_ldap_control_paged_result_response)
#endif
PHP_FE_END
};
/* }}} */
zend_module_entry ldap_module_entry = { /* {{{ */ zend_module_entry ldap_module_entry = { /* {{{ */
STANDARD_MODULE_HEADER, STANDARD_MODULE_HEADER,
"ldap", "ldap",
ldap_functions, ext_functions,
PHP_MINIT(ldap), PHP_MINIT(ldap),
PHP_MSHUTDOWN(ldap), PHP_MSHUTDOWN(ldap),
NULL, NULL,

View file

@ -1,6 +1,6 @@
<?php <?php
//TODO: missing arginfo functions defined in C using /** @generate-function-entries */
#ifdef HAVE_ORALDAP #ifdef HAVE_ORALDAP
/** @return resource|false */ /** @return resource|false */
@ -195,12 +195,16 @@ function ldap_compare($link_identifier, string $dn, string $attribute, string $v
#ifdef LDAP_CONTROL_PAGEDRESULTS #ifdef LDAP_CONTROL_PAGEDRESULTS
/** @param resource $link */ /**
* @param resource $link
* @deprecated since 7.4
*/
function ldap_control_paged_result($link, int $pagesize, bool $iscritical = false, string $cookie = ''): bool {} function ldap_control_paged_result($link, int $pagesize, bool $iscritical = false, string $cookie = ''): bool {}
/** /**
* @param resource $link * @param resource $link
* @param resource $result * @param resource $result
* @deprecated since 7.4
*/ */
function ldap_control_paged_result_response($link, $result, &$cookie = null, &$estimated = null): bool {} function ldap_control_paged_result_response($link, $result, &$cookie = null, &$estimated = null): bool {}
#endif #endif

View file

@ -348,3 +348,213 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_exop, 0, 2, _IS_BOOL,
ZEND_ARG_INFO(1, retoid) ZEND_ARG_INFO(1, retoid)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#endif #endif
#if defined(HAVE_ORALDAP)
ZEND_FUNCTION(ldap_connect);
#endif
#if !(defined(HAVE_ORALDAP))
ZEND_FUNCTION(ldap_connect);
#endif
ZEND_FUNCTION(ldap_unbind);
ZEND_FUNCTION(ldap_bind);
ZEND_FUNCTION(ldap_bind_ext);
#if defined(HAVE_LDAP_SASL)
ZEND_FUNCTION(ldap_sasl_bind);
#endif
ZEND_FUNCTION(ldap_read);
ZEND_FUNCTION(ldap_list);
ZEND_FUNCTION(ldap_search);
ZEND_FUNCTION(ldap_free_result);
ZEND_FUNCTION(ldap_count_entries);
ZEND_FUNCTION(ldap_first_entry);
ZEND_FUNCTION(ldap_next_entry);
ZEND_FUNCTION(ldap_get_entries);
ZEND_FUNCTION(ldap_first_attribute);
ZEND_FUNCTION(ldap_next_attribute);
ZEND_FUNCTION(ldap_get_attributes);
ZEND_FUNCTION(ldap_get_values_len);
ZEND_FUNCTION(ldap_get_dn);
ZEND_FUNCTION(ldap_explode_dn);
ZEND_FUNCTION(ldap_dn2ufn);
ZEND_FUNCTION(ldap_add);
ZEND_FUNCTION(ldap_add_ext);
ZEND_FUNCTION(ldap_delete);
ZEND_FUNCTION(ldap_delete_ext);
ZEND_FUNCTION(ldap_modify_batch);
ZEND_FUNCTION(ldap_mod_add);
ZEND_FUNCTION(ldap_mod_add_ext);
ZEND_FUNCTION(ldap_mod_replace);
ZEND_FUNCTION(ldap_mod_replace_ext);
ZEND_FUNCTION(ldap_mod_del);
ZEND_FUNCTION(ldap_mod_del_ext);
ZEND_FUNCTION(ldap_errno);
ZEND_FUNCTION(ldap_error);
ZEND_FUNCTION(ldap_err2str);
ZEND_FUNCTION(ldap_compare);
#if defined(LDAP_CONTROL_PAGEDRESULTS)
ZEND_FUNCTION(ldap_control_paged_result);
#endif
#if defined(LDAP_CONTROL_PAGEDRESULTS)
ZEND_FUNCTION(ldap_control_paged_result_response);
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
ZEND_FUNCTION(ldap_rename);
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
ZEND_FUNCTION(ldap_rename_ext);
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
ZEND_FUNCTION(ldap_get_option);
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
ZEND_FUNCTION(ldap_set_option);
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
ZEND_FUNCTION(ldap_first_reference);
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
ZEND_FUNCTION(ldap_next_reference);
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_REFERENCE)
ZEND_FUNCTION(ldap_parse_reference);
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_RESULT)
ZEND_FUNCTION(ldap_parse_result);
#endif
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
ZEND_FUNCTION(ldap_set_rebind_proc);
#endif
#if defined(HAVE_LDAP_START_TLS_S)
ZEND_FUNCTION(ldap_start_tls);
#endif
ZEND_FUNCTION(ldap_escape);
#if defined(STR_TRANSLATION)
ZEND_FUNCTION(ldap_t61_to_8859);
#endif
#if defined(STR_TRANSLATION)
ZEND_FUNCTION(ldap_8859_to_t61);
#endif
#if defined(HAVE_LDAP_EXTENDED_OPERATION_S)
ZEND_FUNCTION(ldap_exop);
#endif
#if defined(HAVE_LDAP_PASSWD)
ZEND_FUNCTION(ldap_exop_passwd);
#endif
#if defined(HAVE_LDAP_WHOAMI_S)
ZEND_FUNCTION(ldap_exop_whoami);
#endif
#if defined(HAVE_LDAP_REFRESH_S)
ZEND_FUNCTION(ldap_exop_refresh);
#endif
#if defined(HAVE_LDAP_PARSE_EXTENDED_RESULT)
ZEND_FUNCTION(ldap_parse_exop);
#endif
static const zend_function_entry ext_functions[] = {
#if defined(HAVE_ORALDAP)
ZEND_FE(ldap_connect, arginfo_ldap_connect)
#endif
#if !(defined(HAVE_ORALDAP))
ZEND_FE(ldap_connect, arginfo_ldap_connect)
#endif
ZEND_FE(ldap_unbind, arginfo_ldap_unbind)
ZEND_FALIAS(ldap_close, ldap_unbind, arginfo_ldap_close)
ZEND_FE(ldap_bind, arginfo_ldap_bind)
ZEND_FE(ldap_bind_ext, arginfo_ldap_bind_ext)
#if defined(HAVE_LDAP_SASL)
ZEND_FE(ldap_sasl_bind, arginfo_ldap_sasl_bind)
#endif
ZEND_FE(ldap_read, arginfo_ldap_read)
ZEND_FE(ldap_list, arginfo_ldap_list)
ZEND_FE(ldap_search, arginfo_ldap_search)
ZEND_FE(ldap_free_result, arginfo_ldap_free_result)
ZEND_FE(ldap_count_entries, arginfo_ldap_count_entries)
ZEND_FE(ldap_first_entry, arginfo_ldap_first_entry)
ZEND_FE(ldap_next_entry, arginfo_ldap_next_entry)
ZEND_FE(ldap_get_entries, arginfo_ldap_get_entries)
ZEND_FE(ldap_first_attribute, arginfo_ldap_first_attribute)
ZEND_FE(ldap_next_attribute, arginfo_ldap_next_attribute)
ZEND_FE(ldap_get_attributes, arginfo_ldap_get_attributes)
ZEND_FE(ldap_get_values_len, arginfo_ldap_get_values_len)
ZEND_FALIAS(ldap_get_values, ldap_get_values_len, arginfo_ldap_get_values)
ZEND_FE(ldap_get_dn, arginfo_ldap_get_dn)
ZEND_FE(ldap_explode_dn, arginfo_ldap_explode_dn)
ZEND_FE(ldap_dn2ufn, arginfo_ldap_dn2ufn)
ZEND_FE(ldap_add, arginfo_ldap_add)
ZEND_FE(ldap_add_ext, arginfo_ldap_add_ext)
ZEND_FE(ldap_delete, arginfo_ldap_delete)
ZEND_FE(ldap_delete_ext, arginfo_ldap_delete_ext)
ZEND_FE(ldap_modify_batch, arginfo_ldap_modify_batch)
ZEND_FE(ldap_mod_add, arginfo_ldap_mod_add)
ZEND_FE(ldap_mod_add_ext, arginfo_ldap_mod_add_ext)
ZEND_FE(ldap_mod_replace, arginfo_ldap_mod_replace)
ZEND_FALIAS(ldap_modify, ldap_mod_replace, arginfo_ldap_modify)
ZEND_FE(ldap_mod_replace_ext, arginfo_ldap_mod_replace_ext)
ZEND_FE(ldap_mod_del, arginfo_ldap_mod_del)
ZEND_FE(ldap_mod_del_ext, arginfo_ldap_mod_del_ext)
ZEND_FE(ldap_errno, arginfo_ldap_errno)
ZEND_FE(ldap_error, arginfo_ldap_error)
ZEND_FE(ldap_err2str, arginfo_ldap_err2str)
ZEND_FE(ldap_compare, arginfo_ldap_compare)
#if defined(LDAP_CONTROL_PAGEDRESULTS)
ZEND_DEP_FE(ldap_control_paged_result, arginfo_ldap_control_paged_result)
#endif
#if defined(LDAP_CONTROL_PAGEDRESULTS)
ZEND_DEP_FE(ldap_control_paged_result_response, arginfo_ldap_control_paged_result_response)
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
ZEND_FE(ldap_rename, arginfo_ldap_rename)
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
ZEND_FE(ldap_rename_ext, arginfo_ldap_rename_ext)
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
ZEND_FE(ldap_get_option, arginfo_ldap_get_option)
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
ZEND_FE(ldap_set_option, arginfo_ldap_set_option)
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
ZEND_FE(ldap_first_reference, arginfo_ldap_first_reference)
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
ZEND_FE(ldap_next_reference, arginfo_ldap_next_reference)
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_REFERENCE)
ZEND_FE(ldap_parse_reference, arginfo_ldap_parse_reference)
#endif
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_RESULT)
ZEND_FE(ldap_parse_result, arginfo_ldap_parse_result)
#endif
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
ZEND_FE(ldap_set_rebind_proc, arginfo_ldap_set_rebind_proc)
#endif
#if defined(HAVE_LDAP_START_TLS_S)
ZEND_FE(ldap_start_tls, arginfo_ldap_start_tls)
#endif
ZEND_FE(ldap_escape, arginfo_ldap_escape)
#if defined(STR_TRANSLATION)
ZEND_FE(ldap_t61_to_8859, arginfo_ldap_t61_to_8859)
#endif
#if defined(STR_TRANSLATION)
ZEND_FE(ldap_8859_to_t61, arginfo_ldap_8859_to_t61)
#endif
#if defined(HAVE_LDAP_EXTENDED_OPERATION_S)
ZEND_FE(ldap_exop, arginfo_ldap_exop)
#endif
#if defined(HAVE_LDAP_PASSWD)
ZEND_FE(ldap_exop_passwd, arginfo_ldap_exop_passwd)
#endif
#if defined(HAVE_LDAP_WHOAMI_S)
ZEND_FE(ldap_exop_whoami, arginfo_ldap_exop_whoami)
#endif
#if defined(HAVE_LDAP_REFRESH_S)
ZEND_FE(ldap_exop_refresh, arginfo_ldap_exop_refresh)
#endif
#if defined(HAVE_LDAP_PARSE_EXTENDED_RESULT)
ZEND_FE(ldap_parse_exop, arginfo_ldap_parse_exop)
#endif
ZEND_FE_END
};

View file

@ -311,22 +311,10 @@ PHP_MINFO_FUNCTION(zend_test)
php_info_print_table_end(); php_info_print_table_end();
} }
static const zend_function_entry zend_test_functions[] = {
ZEND_FE(zend_test_array_return, arginfo_zend_test_array_return)
ZEND_FE(zend_test_nullable_array_return, arginfo_zend_test_nullable_array_return)
ZEND_FE(zend_test_void_return, arginfo_zend_test_void_return)
ZEND_DEP_FE(zend_test_deprecated, arginfo_zend_test_deprecated)
ZEND_FE(zend_create_unterminated_string, arginfo_zend_create_unterminated_string)
ZEND_FE(zend_terminate_string, arginfo_zend_terminate_string)
ZEND_FE(zend_leak_bytes, arginfo_zend_leak_bytes)
ZEND_FE(zend_leak_variable, arginfo_zend_leak_variable)
ZEND_FE_END
};
zend_module_entry zend_test_module_entry = { zend_module_entry zend_test_module_entry = {
STANDARD_MODULE_HEADER, STANDARD_MODULE_HEADER,
"zend-test", "zend-test",
zend_test_functions, ext_functions,
PHP_MINIT(zend_test), PHP_MINIT(zend_test),
PHP_MSHUTDOWN(zend_test), PHP_MSHUTDOWN(zend_test),
PHP_RINIT(zend_test), PHP_RINIT(zend_test),

View file

@ -1,5 +1,7 @@
<?php <?php
/** @generate-function-entries */
class _ZendTestClass { class _ZendTestClass {
public static function is_object(): int; public static function is_object(): int;
@ -16,6 +18,7 @@ function zend_test_nullable_array_return(): ?array {}
function zend_test_void_return(): void {} function zend_test_void_return(): void {}
/** @deprecated */
function zend_test_deprecated(): void {} function zend_test_deprecated(): void {}
function zend_create_unterminated_string(string $str): string {} function zend_create_unterminated_string(string $str): string {}

View file

@ -35,3 +35,26 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class__ZendTestTrait_testMethod, 0, 0, _IS_BOOL, 0) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class__ZendTestTrait_testMethod, 0, 0, _IS_BOOL, 0)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_FUNCTION(zend_test_array_return);
ZEND_FUNCTION(zend_test_nullable_array_return);
ZEND_FUNCTION(zend_test_void_return);
ZEND_FUNCTION(zend_test_deprecated);
ZEND_FUNCTION(zend_create_unterminated_string);
ZEND_FUNCTION(zend_terminate_string);
ZEND_FUNCTION(zend_leak_variable);
ZEND_FUNCTION(zend_leak_bytes);
static const zend_function_entry ext_functions[] = {
ZEND_FE(zend_test_array_return, arginfo_zend_test_array_return)
ZEND_FE(zend_test_nullable_array_return, arginfo_zend_test_nullable_array_return)
ZEND_FE(zend_test_void_return, arginfo_zend_test_void_return)
ZEND_DEP_FE(zend_test_deprecated, arginfo_zend_test_deprecated)
ZEND_FE(zend_create_unterminated_string, arginfo_zend_create_unterminated_string)
ZEND_FE(zend_terminate_string, arginfo_zend_terminate_string)
ZEND_FE(zend_leak_variable, arginfo_zend_leak_variable)
ZEND_FE(zend_leak_bytes, arginfo_zend_leak_bytes)
ZEND_FE_END
};