From: Stephen Reay Date: Sat, 10 Aug 2019 12:52:50 +0000 (+0700) Subject: Add stubs for PCRE extension X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=66b750d07e4d2d46fc2644a80305239c6d7addf3;p=php Add stubs for PCRE extension Closes GH-4501. --- diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 6c265df485..6002eedc78 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -20,6 +20,7 @@ #include "php_ini.h" #include "php_globals.h" #include "php_pcre.h" +#include "php_pcre_arginfo.h" #include "ext/standard/info.h" #include "ext/standard/basic_functions.h" #include "zend_smart_str.h" @@ -2910,70 +2911,6 @@ static PHP_FUNCTION(preg_last_error) /* {{{ module definition structures */ -/* {{{ arginfo */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_match, 0, 0, 2) - ZEND_ARG_INFO(0, pattern) - ZEND_ARG_INFO(0, subject) - ZEND_ARG_INFO(1, subpatterns) /* array */ - ZEND_ARG_INFO(0, flags) - ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_match_all, 0, 0, 2) - ZEND_ARG_INFO(0, pattern) - ZEND_ARG_INFO(0, subject) - ZEND_ARG_INFO(1, subpatterns) /* array */ - ZEND_ARG_INFO(0, flags) - ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_replace, 0, 0, 3) - ZEND_ARG_INFO(0, regex) - ZEND_ARG_INFO(0, replace) - ZEND_ARG_INFO(0, subject) - ZEND_ARG_INFO(0, limit) - ZEND_ARG_INFO(1, count) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_replace_callback, 0, 0, 3) - ZEND_ARG_INFO(0, regex) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(0, subject) - ZEND_ARG_INFO(0, limit) - ZEND_ARG_INFO(1, count) - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_replace_callback_array, 0, 0, 2) - ZEND_ARG_INFO(0, pattern) - ZEND_ARG_INFO(0, subject) - ZEND_ARG_INFO(0, limit) - ZEND_ARG_INFO(1, count) - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_split, 0, 0, 2) - ZEND_ARG_INFO(0, pattern) - ZEND_ARG_INFO(0, subject) - ZEND_ARG_INFO(0, limit) - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_quote, 0, 0, 1) - ZEND_ARG_INFO(0, str) - ZEND_ARG_INFO(0, delim_char) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_grep, 0, 0, 2) - ZEND_ARG_INFO(0, regex) - ZEND_ARG_INFO(0, input) /* array */ - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_preg_last_error, 0) -ZEND_END_ARG_INFO() -/* }}} */ - static const zend_function_entry pcre_functions[] = { PHP_FE(preg_match, arginfo_preg_match) PHP_FE(preg_match_all, arginfo_preg_match_all) diff --git a/ext/pcre/php_pcre.stub.php b/ext/pcre/php_pcre.stub.php new file mode 100644 index 0000000000..f4730f1b60 --- /dev/null +++ b/ext/pcre/php_pcre.stub.php @@ -0,0 +1,52 @@ + extension #%d pcre version %s ] { Function [ function preg_match ] { - Parameters [5] { - Parameter #0 [ $pattern ] - Parameter #1 [ $subject ] + Parameter #0 [ string $pattern ] + Parameter #1 [ string $subject ] Parameter #2 [ &$subpatterns ] - Parameter #3 [ $flags ] - Parameter #4 [ $offset ] + Parameter #3 [ int $flags ] + Parameter #4 [ int $offset ] } } Function [ function preg_match_all ] { - Parameters [5] { - Parameter #0 [ $pattern ] - Parameter #1 [ $subject ] + Parameter #0 [ string $pattern ] + Parameter #1 [ string $subject ] Parameter #2 [ &$subpatterns ] - Parameter #3 [ $flags ] - Parameter #4 [ $offset ] + Parameter #3 [ int $flags ] + Parameter #4 [ int $offset ] } } Function [ function preg_replace ] { @@ -91,7 +91,7 @@ string(%d) "Extension [ extension #%d pcre version %s ] { Parameter #0 [ $regex ] Parameter #1 [ $replace ] Parameter #2 [ $subject ] - Parameter #3 [ $limit ] + Parameter #3 [ int $limit ] Parameter #4 [ &$count ] } } @@ -101,19 +101,19 @@ string(%d) "Extension [ extension #%d pcre version %s ] { Parameter #0 [ $regex ] Parameter #1 [ $callback ] Parameter #2 [ $subject ] - Parameter #3 [ $limit ] + Parameter #3 [ int $limit ] Parameter #4 [ &$count ] - Parameter #5 [ $flags ] + Parameter #5 [ int $flags ] } } Function [ function preg_replace_callback_array ] { - Parameters [5] { - Parameter #0 [ $pattern ] + Parameter #0 [ array $pattern ] Parameter #1 [ $subject ] - Parameter #2 [ $limit ] + Parameter #2 [ int $limit ] Parameter #3 [ &$count ] - Parameter #4 [ $flags ] + Parameter #4 [ int $flags ] } } Function [ function preg_filter ] { @@ -122,38 +122,40 @@ string(%d) "Extension [ extension #%d pcre version %s ] { Parameter #0 [ $regex ] Parameter #1 [ $replace ] Parameter #2 [ $subject ] - Parameter #3 [ $limit ] + Parameter #3 [ int $limit ] Parameter #4 [ &$count ] } } Function [ function preg_split ] { - Parameters [4] { - Parameter #0 [ $pattern ] - Parameter #1 [ $subject ] - Parameter #2 [ $limit ] - Parameter #3 [ $flags ] + Parameter #0 [ string $pattern ] + Parameter #1 [ string $subject ] + Parameter #2 [ int $limit ] + Parameter #3 [ int $flags ] } } Function [ function preg_quote ] { - Parameters [2] { - Parameter #0 [ $str ] - Parameter #1 [ $delim_char ] + Parameter #0 [ string $str ] + Parameter #1 [ string or NULL $delim_char ] } + - Return [ string ] } Function [ function preg_grep ] { - Parameters [3] { - Parameter #0 [ $regex ] - Parameter #1 [ $input ] - Parameter #2 [ $flags ] + Parameter #0 [ string $regex ] + Parameter #1 [ array $input ] + Parameter #2 [ int $flags ] } } Function [ function preg_last_error ] { - Parameters [0] { } + - Return [ int ] } } }