mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Declare ext/standard constants in stubs - part 7 (#9505)
This commit is contained in:
parent
580c29e1a2
commit
3227d04fa9
5 changed files with 126 additions and 51 deletions
|
@ -304,7 +304,6 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
|
||||||
|
|
||||||
register_phpinfo_constants(INIT_FUNC_ARGS_PASSTHRU);
|
register_phpinfo_constants(INIT_FUNC_ARGS_PASSTHRU);
|
||||||
register_html_constants(INIT_FUNC_ARGS_PASSTHRU);
|
register_html_constants(INIT_FUNC_ARGS_PASSTHRU);
|
||||||
register_string_constants(INIT_FUNC_ARGS_PASSTHRU);
|
|
||||||
|
|
||||||
BASIC_MINIT_SUBMODULE(var)
|
BASIC_MINIT_SUBMODULE(var)
|
||||||
BASIC_MINIT_SUBMODULE(file)
|
BASIC_MINIT_SUBMODULE(file)
|
||||||
|
|
|
@ -740,6 +740,93 @@ const LOG_NOWAIT = UNKNOWN;
|
||||||
const LOG_PERROR = UNKNOWN;
|
const LOG_PERROR = UNKNOWN;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* string.c */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue PHP_STR_PAD_LEFT
|
||||||
|
*/
|
||||||
|
const STR_PAD_LEFT = UNKNOWN;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue PHP_STR_PAD_RIGHT
|
||||||
|
*/
|
||||||
|
const STR_PAD_RIGHT = UNKNOWN;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue PHP_STR_PAD_BOTH
|
||||||
|
*/
|
||||||
|
const STR_PAD_BOTH = UNKNOWN;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue PHP_PATHINFO_DIRNAME
|
||||||
|
*/
|
||||||
|
const PATHINFO_DIRNAME = UNKNOWN;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue PHP_PATHINFO_BASENAME
|
||||||
|
*/
|
||||||
|
const PATHINFO_BASENAME = UNKNOWN;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue PHP_PATHINFO_EXTENSION
|
||||||
|
*/
|
||||||
|
const PATHINFO_EXTENSION = UNKNOWN;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue PHP_PATHINFO_FILENAME
|
||||||
|
*/
|
||||||
|
const PATHINFO_FILENAME = UNKNOWN;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue PHP_PATHINFO_ALL
|
||||||
|
*/
|
||||||
|
const PATHINFO_ALL = UNKNOWN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If last members of struct lconv equal CHAR_MAX, no grouping is done
|
||||||
|
* @var int
|
||||||
|
* @cvalue CHAR_MAX
|
||||||
|
*/
|
||||||
|
const CHAR_MAX = UNKNOWN;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue LC_CTYPE
|
||||||
|
*/
|
||||||
|
const LC_CTYPE = UNKNOWN;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue LC_NUMERIC
|
||||||
|
*/
|
||||||
|
const LC_NUMERIC = UNKNOWN;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue LC_TIME
|
||||||
|
*/
|
||||||
|
const LC_TIME = UNKNOWN;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue LC_COLLATE
|
||||||
|
*/
|
||||||
|
const LC_COLLATE = UNKNOWN;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue LC_MONETARY
|
||||||
|
*/
|
||||||
|
const LC_MONETARY = UNKNOWN;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue LC_ALL
|
||||||
|
*/
|
||||||
|
const LC_ALL = UNKNOWN;
|
||||||
|
#ifdef LC_MESSAGES
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @cvalue LC_MESSAGES
|
||||||
|
*/
|
||||||
|
const LC_MESSAGES = UNKNOWN;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** @undocumentable */
|
/** @undocumentable */
|
||||||
#[AllowDynamicProperties]
|
#[AllowDynamicProperties]
|
||||||
final class __PHP_Incomplete_Class
|
final class __PHP_Incomplete_Class
|
||||||
|
|
20
ext/standard/basic_functions_arginfo.h
generated
20
ext/standard/basic_functions_arginfo.h
generated
|
@ -1,5 +1,5 @@
|
||||||
/* This is a generated file, edit the .stub.php file instead.
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
* Stub hash: 9e0016895111851aa2c635e1380a18cd7963e58e */
|
* Stub hash: e46c8ef36dc0f29d877ae6e4096135414d0a4412 */
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
|
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
|
||||||
|
@ -3695,6 +3695,24 @@ static void register_basic_functions_symbols(int module_number)
|
||||||
#if defined(LOG_PERROR)
|
#if defined(LOG_PERROR)
|
||||||
REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_PERSISTENT);
|
||||||
#endif
|
#endif
|
||||||
|
REGISTER_LONG_CONSTANT("STR_PAD_LEFT", PHP_STR_PAD_LEFT, CONST_PERSISTENT);
|
||||||
|
REGISTER_LONG_CONSTANT("STR_PAD_RIGHT", PHP_STR_PAD_RIGHT, CONST_PERSISTENT);
|
||||||
|
REGISTER_LONG_CONSTANT("STR_PAD_BOTH", PHP_STR_PAD_BOTH, CONST_PERSISTENT);
|
||||||
|
REGISTER_LONG_CONSTANT("PATHINFO_DIRNAME", PHP_PATHINFO_DIRNAME, CONST_PERSISTENT);
|
||||||
|
REGISTER_LONG_CONSTANT("PATHINFO_BASENAME", PHP_PATHINFO_BASENAME, CONST_PERSISTENT);
|
||||||
|
REGISTER_LONG_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_PERSISTENT);
|
||||||
|
REGISTER_LONG_CONSTANT("PATHINFO_FILENAME", PHP_PATHINFO_FILENAME, CONST_PERSISTENT);
|
||||||
|
REGISTER_LONG_CONSTANT("PATHINFO_ALL", PHP_PATHINFO_ALL, CONST_PERSISTENT);
|
||||||
|
REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_PERSISTENT);
|
||||||
|
REGISTER_LONG_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_PERSISTENT);
|
||||||
|
REGISTER_LONG_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_PERSISTENT);
|
||||||
|
REGISTER_LONG_CONSTANT("LC_TIME", LC_TIME, CONST_PERSISTENT);
|
||||||
|
REGISTER_LONG_CONSTANT("LC_COLLATE", LC_COLLATE, CONST_PERSISTENT);
|
||||||
|
REGISTER_LONG_CONSTANT("LC_MONETARY", LC_MONETARY, CONST_PERSISTENT);
|
||||||
|
REGISTER_LONG_CONSTANT("LC_ALL", LC_ALL, CONST_PERSISTENT);
|
||||||
|
#if defined(LC_MESSAGES)
|
||||||
|
REGISTER_LONG_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_PERSISTENT);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
zend_add_parameter_attribute(zend_hash_str_find_ptr(CG(function_table), "crypt", sizeof("crypt") - 1), 0, ZSTR_KNOWN(ZEND_STR_SENSITIVEPARAMETER), 0);
|
zend_add_parameter_attribute(zend_hash_str_find_ptr(CG(function_table), "crypt", sizeof("crypt") - 1), 0, ZSTR_KNOWN(ZEND_STR_SENSITIVEPARAMETER), 0);
|
||||||
|
|
|
@ -78,6 +78,16 @@ PHPAPI bool php_binary_string_shuffle(const php_random_algo *algo, php_random_st
|
||||||
# define php_mb_reset() php_ignore_value(mblen(NULL, 0))
|
# define php_mb_reset() php_ignore_value(mblen(NULL, 0))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void register_string_constants(INIT_FUNC_ARGS);
|
#define PHP_STR_PAD_LEFT 0
|
||||||
|
#define PHP_STR_PAD_RIGHT 1
|
||||||
|
#define PHP_STR_PAD_BOTH 2
|
||||||
|
#define PHP_PATHINFO_DIRNAME 1
|
||||||
|
#define PHP_PATHINFO_BASENAME 2
|
||||||
|
#define PHP_PATHINFO_EXTENSION 4
|
||||||
|
#define PHP_PATHINFO_FILENAME 8
|
||||||
|
#define PHP_PATHINFO_ALL (PHP_PATHINFO_DIRNAME | PHP_PATHINFO_BASENAME | PHP_PATHINFO_EXTENSION | PHP_PATHINFO_FILENAME)
|
||||||
|
|
||||||
|
#define PHP_STR_STRSPN 0
|
||||||
|
#define PHP_STR_STRCSPN 1
|
||||||
|
|
||||||
#endif /* PHP_STRING_H */
|
#endif /* PHP_STRING_H */
|
||||||
|
|
|
@ -50,45 +50,6 @@
|
||||||
#include <emmintrin.h>
|
#include <emmintrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STR_PAD_LEFT 0
|
|
||||||
#define STR_PAD_RIGHT 1
|
|
||||||
#define STR_PAD_BOTH 2
|
|
||||||
#define PHP_PATHINFO_DIRNAME 1
|
|
||||||
#define PHP_PATHINFO_BASENAME 2
|
|
||||||
#define PHP_PATHINFO_EXTENSION 4
|
|
||||||
#define PHP_PATHINFO_FILENAME 8
|
|
||||||
#define PHP_PATHINFO_ALL (PHP_PATHINFO_DIRNAME | PHP_PATHINFO_BASENAME | PHP_PATHINFO_EXTENSION | PHP_PATHINFO_FILENAME)
|
|
||||||
|
|
||||||
#define STR_STRSPN 0
|
|
||||||
#define STR_STRCSPN 1
|
|
||||||
|
|
||||||
/* {{{ register_string_constants */
|
|
||||||
void register_string_constants(INIT_FUNC_ARGS)
|
|
||||||
{
|
|
||||||
REGISTER_LONG_CONSTANT("STR_PAD_LEFT", STR_PAD_LEFT, CONST_CS | CONST_PERSISTENT);
|
|
||||||
REGISTER_LONG_CONSTANT("STR_PAD_RIGHT", STR_PAD_RIGHT, CONST_CS | CONST_PERSISTENT);
|
|
||||||
REGISTER_LONG_CONSTANT("STR_PAD_BOTH", STR_PAD_BOTH, CONST_CS | CONST_PERSISTENT);
|
|
||||||
REGISTER_LONG_CONSTANT("PATHINFO_DIRNAME", PHP_PATHINFO_DIRNAME, CONST_CS | CONST_PERSISTENT);
|
|
||||||
REGISTER_LONG_CONSTANT("PATHINFO_BASENAME", PHP_PATHINFO_BASENAME, CONST_CS | CONST_PERSISTENT);
|
|
||||||
REGISTER_LONG_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT);
|
|
||||||
REGISTER_LONG_CONSTANT("PATHINFO_FILENAME", PHP_PATHINFO_FILENAME, CONST_CS | CONST_PERSISTENT);
|
|
||||||
REGISTER_LONG_CONSTANT("PATHINFO_ALL", PHP_PATHINFO_ALL, CONST_CS | CONST_PERSISTENT);
|
|
||||||
|
|
||||||
/* If last members of struct lconv equal CHAR_MAX, no grouping is done */
|
|
||||||
REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT);
|
|
||||||
REGISTER_LONG_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS | CONST_PERSISTENT);
|
|
||||||
REGISTER_LONG_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS | CONST_PERSISTENT);
|
|
||||||
REGISTER_LONG_CONSTANT("LC_TIME", LC_TIME, CONST_CS | CONST_PERSISTENT);
|
|
||||||
REGISTER_LONG_CONSTANT("LC_COLLATE", LC_COLLATE, CONST_CS | CONST_PERSISTENT);
|
|
||||||
REGISTER_LONG_CONSTANT("LC_MONETARY", LC_MONETARY, CONST_CS | CONST_PERSISTENT);
|
|
||||||
REGISTER_LONG_CONSTANT("LC_ALL", LC_ALL, CONST_CS | CONST_PERSISTENT);
|
|
||||||
# ifdef LC_MESSAGES
|
|
||||||
REGISTER_LONG_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS | CONST_PERSISTENT);
|
|
||||||
# endif
|
|
||||||
|
|
||||||
}
|
|
||||||
/* }}} */
|
|
||||||
|
|
||||||
/* this is read-only, so it's ok */
|
/* this is read-only, so it's ok */
|
||||||
ZEND_SET_ALIGNED(16, static const char hexconvtab[]) = "0123456789abcdef";
|
ZEND_SET_ALIGNED(16, static const char hexconvtab[]) = "0123456789abcdef";
|
||||||
|
|
||||||
|
@ -288,13 +249,13 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /
|
||||||
RETURN_LONG(0);
|
RETURN_LONG(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (behavior == STR_STRSPN) {
|
if (behavior == PHP_STR_STRSPN) {
|
||||||
RETURN_LONG(php_strspn(ZSTR_VAL(s11) + start /*str1_start*/,
|
RETURN_LONG(php_strspn(ZSTR_VAL(s11) + start /*str1_start*/,
|
||||||
ZSTR_VAL(s22) /*str2_start*/,
|
ZSTR_VAL(s22) /*str2_start*/,
|
||||||
ZSTR_VAL(s11) + start + len /*str1_end*/,
|
ZSTR_VAL(s11) + start + len /*str1_end*/,
|
||||||
ZSTR_VAL(s22) + ZSTR_LEN(s22) /*str2_end*/));
|
ZSTR_VAL(s22) + ZSTR_LEN(s22) /*str2_end*/));
|
||||||
} else {
|
} else {
|
||||||
ZEND_ASSERT(behavior == STR_STRCSPN);
|
ZEND_ASSERT(behavior == PHP_STR_STRCSPN);
|
||||||
RETURN_LONG(php_strcspn(ZSTR_VAL(s11) + start /*str1_start*/,
|
RETURN_LONG(php_strcspn(ZSTR_VAL(s11) + start /*str1_start*/,
|
||||||
ZSTR_VAL(s22) /*str2_start*/,
|
ZSTR_VAL(s22) /*str2_start*/,
|
||||||
ZSTR_VAL(s11) + start + len /*str1_end*/,
|
ZSTR_VAL(s11) + start + len /*str1_end*/,
|
||||||
|
@ -306,14 +267,14 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /
|
||||||
/* {{{ Finds length of initial segment consisting entirely of characters found in mask. If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) */
|
/* {{{ Finds length of initial segment consisting entirely of characters found in mask. If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) */
|
||||||
PHP_FUNCTION(strspn)
|
PHP_FUNCTION(strspn)
|
||||||
{
|
{
|
||||||
php_spn_common_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU, STR_STRSPN);
|
php_spn_common_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_STR_STRSPN);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Finds length of initial segment consisting entirely of characters not found in mask. If start or/and length is provide works like strcspn(substr($s,$start,$len),$bad_chars) */
|
/* {{{ Finds length of initial segment consisting entirely of characters not found in mask. If start or/and length is provide works like strcspn(substr($s,$start,$len),$bad_chars) */
|
||||||
PHP_FUNCTION(strcspn)
|
PHP_FUNCTION(strcspn)
|
||||||
{
|
{
|
||||||
php_spn_common_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU, STR_STRCSPN);
|
php_spn_common_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_STR_STRCSPN);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
@ -5550,7 +5511,7 @@ PHP_FUNCTION(str_pad)
|
||||||
size_t num_pad_chars; /* Number of padding characters (total - input size) */
|
size_t num_pad_chars; /* Number of padding characters (total - input size) */
|
||||||
char *pad_str = " "; /* Pointer to padding string */
|
char *pad_str = " "; /* Pointer to padding string */
|
||||||
size_t pad_str_len = 1;
|
size_t pad_str_len = 1;
|
||||||
zend_long pad_type_val = STR_PAD_RIGHT; /* The padding type value */
|
zend_long pad_type_val = PHP_STR_PAD_RIGHT; /* The padding type value */
|
||||||
size_t i, left_pad=0, right_pad=0;
|
size_t i, left_pad=0, right_pad=0;
|
||||||
zend_string *result = NULL; /* Resulting string */
|
zend_string *result = NULL; /* Resulting string */
|
||||||
|
|
||||||
|
@ -5573,7 +5534,7 @@ PHP_FUNCTION(str_pad)
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pad_type_val < STR_PAD_LEFT || pad_type_val > STR_PAD_BOTH) {
|
if (pad_type_val < PHP_STR_PAD_LEFT || pad_type_val > PHP_STR_PAD_BOTH) {
|
||||||
zend_argument_value_error(4, "must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH");
|
zend_argument_value_error(4, "must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH");
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
@ -5584,17 +5545,17 @@ PHP_FUNCTION(str_pad)
|
||||||
|
|
||||||
/* We need to figure out the left/right padding lengths. */
|
/* We need to figure out the left/right padding lengths. */
|
||||||
switch (pad_type_val) {
|
switch (pad_type_val) {
|
||||||
case STR_PAD_RIGHT:
|
case PHP_STR_PAD_RIGHT:
|
||||||
left_pad = 0;
|
left_pad = 0;
|
||||||
right_pad = num_pad_chars;
|
right_pad = num_pad_chars;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STR_PAD_LEFT:
|
case PHP_STR_PAD_LEFT:
|
||||||
left_pad = num_pad_chars;
|
left_pad = num_pad_chars;
|
||||||
right_pad = 0;
|
right_pad = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STR_PAD_BOTH:
|
case PHP_STR_PAD_BOTH:
|
||||||
left_pad = num_pad_chars / 2;
|
left_pad = num_pad_chars / 2;
|
||||||
right_pad = num_pad_chars - left_pad;
|
right_pad = num_pad_chars - left_pad;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue