]> granicus.if.org Git - php/commitdiff
Improve gen_stub.php
authorMáté Kocsis <kocsismate@woohoolabs.com>
Sat, 4 Apr 2020 19:26:46 +0000 (21:26 +0200)
committerMáté Kocsis <kocsismate@woohoolabs.com>
Sat, 4 Apr 2020 21:52:33 +0000 (23:52 +0200)
Closes GH-5350
Add support for generating deprecated function entries, as well as forward declaration
of function aliases.

build/gen_stub.php
ext/bz2/bz2.c
ext/bz2/bz2.stub.php
ext/bz2/bz2_arginfo.h
ext/ldap/ldap.c
ext/ldap/ldap.stub.php
ext/ldap/ldap_arginfo.h
ext/zend_test/test.c
ext/zend_test/test.stub.php
ext/zend_test/test_arginfo.h

index 2207a1348b90c63d01c571f3d72efcd463524e43..ecad6fd81db7a33b99dadd60b159e8bc66f5f3c8 100755 (executable)
@@ -304,6 +304,8 @@ class FuncInfo {
     public $className;
     /** @var ?string */
     public $alias;
+    /** @var bool */
+    public $isDeprecated;
     /** @var ArgInfo[] */
     public $args;
     /** @var ReturnInfo */
@@ -314,12 +316,13 @@ class FuncInfo {
     public $cond;
 
     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
     ) {
         $this->name = $name;
         $this->className = $className;
         $this->alias = $alias;
+        $this->isDeprecated = $isDeprecated;
         $this->args = $args;
         $this->return = $return;
         $this->numRequiredArgs = $numRequiredArgs;
@@ -419,7 +422,7 @@ function parseDocComment(DocComment $comment): array {
     $commentText = substr($comment->getText(), 2, -2);
     $tags = [];
     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)) {
             $tags[] = new DocCommentTag($matches[1], $matches[2]);
         }
@@ -434,6 +437,7 @@ function parseFunctionLike(
     $comment = $func->getDocComment();
     $paramMeta = [];
     $alias = null;
+    $isDeprecated = false;
     $haveDocReturnType = false;
 
     if ($comment) {
@@ -447,6 +451,8 @@ function parseFunctionLike(
                 $paramMeta[$varName]['preferRef'] = true;
             } else if ($tag->name === 'alias') {
                 $alias = $tag->getValue();
+            } else if ($tag->name === 'deprecated') {
+                $isDeprecated = true;
             } else if ($tag->name === 'return') {
                 $haveDocReturnType = true;
             }
@@ -507,7 +513,7 @@ function parseFunctionLike(
     $return = new ReturnInfo(
         $func->returnsByRef(),
         $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 {
@@ -737,6 +743,7 @@ function generateCodeWithConditions(
 }
 
 function generateArgInfoCode(FileInfo $fileInfo): string {
+    $generatedDeclarations = [];
     $funcInfos = $fileInfo->funcInfos;
 
     $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) {
         $code .= "\n\n";
-        $code .= generateCodeWithConditions($fileInfo->funcInfos, "", function(FuncInfo $funcInfo) {
-            if ($funcInfo->alias) {
+        $code .= generateCodeWithConditions($funcInfos, "", function(FuncInfo $funcInfo) use (&$generatedDeclarations) {
+            $name = $funcInfo->alias ?? $funcInfo->name;
+            $key = "$name|$funcInfo->cond";
+            if (isset($generatedDeclarations[$key])) {
                 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";
@@ -776,9 +786,13 @@ function generateArgInfoCode(FileInfo $fileInfo): string {
                     "\tZEND_FALIAS(%s, %s, %s)\n",
                     $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 .= "};\n";
index 005520c2ad01808a5a93df0607efbefac3161a3e..29046e7122093c5d5c510824fe6040c007b7f60f 100644 (file)
@@ -25,7 +25,6 @@
 #if HAVE_BZ2
 
 /* PHP Includes */
-#include "ext/standard/file.h"
 #include "ext/standard/info.h"
 #include "ext/standard/php_string.h"
 #include "main/php_network.h"
 static PHP_MINIT_FUNCTION(bz2);
 static PHP_MSHUTDOWN_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 = {
        STANDARD_MODULE_HEADER,
        "bz2",
-       bz2_functions,
+       ext_functions,
        PHP_MINIT(bz2),
        PHP_MSHUTDOWN(bz2),
        NULL,
@@ -325,7 +303,7 @@ static PHP_MINFO_FUNCTION(bz2)
 
 /* {{{ proto string bzread(resource bz[, int length])
    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;
        zend_long len = 1024;
@@ -353,7 +331,7 @@ static PHP_FUNCTION(bzread)
 
 /* {{{ proto resource bzopen(string|int file|fp, string mode)
    Opens a new BZip2 stream */
-static PHP_FUNCTION(bzopen)
+PHP_FUNCTION(bzopen)
 {
        zval     *file;   /* The file to open */
        char     *mode;   /* The mode to open the stream with */
@@ -444,7 +422,7 @@ static PHP_FUNCTION(bzopen)
 
 /* {{{ proto int bzerrno(resource bz)
    Returns the error number */
-static PHP_FUNCTION(bzerrno)
+PHP_FUNCTION(bzerrno)
 {
        php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRNO);
 }
@@ -452,7 +430,7 @@ static PHP_FUNCTION(bzerrno)
 
 /* {{{ proto string bzerrstr(resource bz)
    Returns the error string */
-static PHP_FUNCTION(bzerrstr)
+PHP_FUNCTION(bzerrstr)
 {
        php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRSTR);
 }
@@ -460,7 +438,7 @@ static PHP_FUNCTION(bzerrstr)
 
 /* {{{ proto array bzerror(resource bz)
    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);
 }
@@ -468,7 +446,7 @@ static PHP_FUNCTION(bzerror)
 
 /* {{{ proto string bzcompress(string source [, int blocksize100k [, int workfactor]])
    Compresses a string into BZip2 encoded data */
-static PHP_FUNCTION(bzcompress)
+PHP_FUNCTION(bzcompress)
 {
        char             *source;          /* Source data to compress */
        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])
    Decompresses BZip2 compressed data */
-static PHP_FUNCTION(bzdecompress)
+PHP_FUNCTION(bzdecompress)
 {
        char *source;
        zend_string *dest;
index 6c871e39907468c99e20a9cb7a139237e1c9f376..2d47c045013bb198e4390931a41f5b6d196f1558 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+/** @generate-function-entries */
+
 /**
  * @param string|resource $file
  * @return resource|false
index 5010a959a3c76f41428d726fc99d5c7fc9508609..297f45e4a4e65b09053ad99dde67adbaf68366ff 100644 (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, small, IS_LONG, 0)
 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
+};
index a5bbc68238f4b8fb6e45bb9b1daf50e89d370dad..47787e82d47aa2cb220565f21c805b9559ef99e6 100644 (file)
@@ -4374,116 +4374,10 @@ PHP_FUNCTION(ldap_exop_refresh)
 /* }}} */
 #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 = { /* {{{ */
        STANDARD_MODULE_HEADER,
        "ldap",
-       ldap_functions,
+       ext_functions,
        PHP_MINIT(ldap),
        PHP_MSHUTDOWN(ldap),
        NULL,
index 8224bc15837f57b863415bdf170af388a48ead29..afe6b7e91894fe75f3608ef53b63a7a353ab3461 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-//TODO: missing arginfo functions defined in C using
+/** @generate-function-entries */
 
 #ifdef HAVE_ORALDAP
 /** @return resource|false */
@@ -195,12 +195,16 @@ function ldap_compare($link_identifier, string $dn, string $attribute, string $v
 
 
 #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 {}
 
 /**
  * @param resource $link
  * @param resource $result
+ * @deprecated since 7.4
  */
 function ldap_control_paged_result_response($link, $result, &$cookie = null, &$estimated = null): bool {}
 #endif
index b03bd99f25202222a5ee7290c3e9d844cd99c69f..04a45fb06ed7acdf7d7f5d6df9134e0fb6f8392f 100644 (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_END_ARG_INFO()
 #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
+};
index 185120234899c49e2c45aeeaef9e65c51b109791..f7c2913fac28856ffa954ad3c6f4202dd6c38909 100644 (file)
@@ -311,22 +311,10 @@ PHP_MINFO_FUNCTION(zend_test)
        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 = {
        STANDARD_MODULE_HEADER,
        "zend-test",
-       zend_test_functions,
+       ext_functions,
        PHP_MINIT(zend_test),
        PHP_MSHUTDOWN(zend_test),
        PHP_RINIT(zend_test),
index b75dfea9c02346c3742af354d1e6b5259a046109..84724fd2557b1b20d4f04b6eb2ebca02d53f34bd 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+/** @generate-function-entries */
+
 class _ZendTestClass {
     public static function is_object(): int;
 
@@ -16,6 +18,7 @@ function zend_test_nullable_array_return(): ?array {}
 
 function zend_test_void_return(): void {}
 
+/** @deprecated */
 function zend_test_deprecated(): void {}
 
 function zend_create_unterminated_string(string $str): string {}
index 71f94d6d14fb3340ac013c0796888eb7b97d9a60..b9924aef34cc37a11edf7855b7596db1f06320da 100644 (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_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
+};