Allow internal functions to declare if they support compile-time evaluation, add functions. (#7780)

https://wiki.php.net/rfc/strtolower-ascii means that these functions no longer
depend on the current locale in php 8.2. Before that, this was unsafe to
evaluate at compile time.

Followup to GH-7506

Add strcmp/strcasecmp/strtolower/strtoupper functions

Add bin2hex/hex2bin and related functions

Update test of garbage collection using strtolower to use something else to create a refcounted string
This commit is contained in:
Tyson Andre 2021-12-20 09:27:06 -05:00 committed by GitHub
parent 3414ae6c0c
commit 32e2d97a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 291 additions and 155 deletions

View File

@ -799,59 +799,21 @@ static inline zend_result ct_eval_array_key_exists(zval *result, zval *op1, zval
return SUCCESS;
}
static bool can_ct_eval_func_call(zend_string *name, uint32_t num_args, zval **args) {
/* Functions in this list must always produce the same result for the same arguments,
static bool can_ct_eval_func_call(zend_function *func, zend_string *name, uint32_t num_args, zval **args) {
/* Precondition: func->type == ZEND_INTERNAL_FUNCTION, this is a global function */
/* Functions setting ZEND_ACC_COMPILE_TIME_EVAL (@compile-time-eval) must always produce the same result for the same arguments,
* and have no dependence on global state (such as locales). It is okay if they throw
* or warn on invalid arguments, as we detect this and will discard the evaluation result. */
if (false
|| zend_string_equals_literal(name, "array_diff")
|| zend_string_equals_literal(name, "array_diff_assoc")
|| zend_string_equals_literal(name, "array_diff_key")
|| zend_string_equals_literal(name, "array_flip")
|| zend_string_equals_literal(name, "array_is_list")
|| zend_string_equals_literal(name, "array_key_exists")
|| zend_string_equals_literal(name, "array_keys")
|| zend_string_equals_literal(name, "array_merge")
|| zend_string_equals_literal(name, "array_merge_recursive")
|| zend_string_equals_literal(name, "array_replace")
|| zend_string_equals_literal(name, "array_replace_recursive")
|| zend_string_equals_literal(name, "array_unique")
|| zend_string_equals_literal(name, "array_values")
|| zend_string_equals_literal(name, "base64_decode")
|| zend_string_equals_literal(name, "base64_encode")
#ifndef ZEND_WIN32
/* On Windows this function may be code page dependent. */
|| zend_string_equals_literal(name, "dirname")
#endif
|| zend_string_equals_literal(name, "explode")
|| zend_string_equals_literal(name, "imagetypes")
|| zend_string_equals_literal(name, "in_array")
|| zend_string_equals_literal(name, "implode")
|| zend_string_equals_literal(name, "ltrim")
|| zend_string_equals_literal(name, "php_sapi_name")
|| zend_string_equals_literal(name, "php_uname")
|| zend_string_equals_literal(name, "phpversion")
|| zend_string_equals_literal(name, "pow")
|| zend_string_equals_literal(name, "preg_quote")
|| zend_string_equals_literal(name, "rawurldecode")
|| zend_string_equals_literal(name, "rawurlencode")
|| zend_string_equals_literal(name, "rtrim")
|| zend_string_equals_literal(name, "serialize")
|| zend_string_equals_literal(name, "str_contains")
|| zend_string_equals_literal(name, "str_ends_with")
|| zend_string_equals_literal(name, "str_replace")
|| zend_string_equals_literal(name, "str_split")
|| zend_string_equals_literal(name, "str_starts_with")
|| zend_string_equals_literal(name, "strpos")
|| zend_string_equals_literal(name, "strstr")
|| zend_string_equals_literal(name, "substr")
|| zend_string_equals_literal(name, "trim")
|| zend_string_equals_literal(name, "urldecode")
|| zend_string_equals_literal(name, "urlencode")
|| zend_string_equals_literal(name, "version_compare")
) {
if (func->common.fn_flags & ZEND_ACC_COMPILE_TIME_EVAL) {
/* This has @compile-time-eval in stub info and uses a macro such as ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE */
return true;
}
#ifndef ZEND_WIN32
/* On Windows this function may be code page dependent. */
if (zend_string_equals_literal(name, "dirname")) {
return true;
}
#endif
if (num_args == 2) {
if (zend_string_equals_literal(name, "str_repeat")) {
@ -918,7 +880,7 @@ static inline zend_result ct_eval_func_call(
}
}
if (!can_ct_eval_func_call(name, num_args, args)) {
if (!can_ct_eval_func_call(func, name, num_args, args)) {
return FAILURE;
}

View File

@ -2,8 +2,14 @@
Bug #38623 (leaks in a tricky code with switch() and exceptions)
--FILE--
<?php
/* This used to use strtolower, but opcache evaluates that at compile time as of php 8.2 https://wiki.php.net/rfc/strtolower-ascii */
function create_refcounted_string() {
$x = 'bpache';
$x[0] = 'a';
return $x;
}
try {
switch(strtolower("apache")) {
switch(create_refcounted_string()) {
case "apache":
throw new Exception("test");
break;

View File

@ -95,6 +95,17 @@ typedef struct _zend_fcall_info_cache {
#define ZEND_NS_FENTRY(ns, zend_name, name, arg_info, flags) ZEND_RAW_FENTRY(ZEND_NS_NAME(ns, #zend_name), name, arg_info, flags)
#define ZEND_NS_RAW_FENTRY(ns, zend_name, name, arg_info, flags) ZEND_RAW_FENTRY(ZEND_NS_NAME(ns, zend_name), name, arg_info, flags)
/**
* Note that if you are asserting that a function is compile-time evaluable, you are asserting that
*
* 1. The function will always have the same result for the same arguments
* 2. The function does not depend on global state such as ini settings or locale (e.g. mb_strtolower), number_format(), etc.
* 3. The function does not have side effects. It is okay if they throw
* or warn on invalid arguments, as we detect this and will discard the evaluation result.
* 4. The function will not take an unreasonable amount of time or memory to compute on code that may be seen in practice.
* (e.g. str_repeat is special cased to check the length instead of using this)
*/
#define ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(name, arg_info) ZEND_RAW_FENTRY(#name, zif_##name, arg_info, ZEND_ACC_COMPILE_TIME_EVAL)
/* Same as ZEND_NS_NAMED_FE */
#define ZEND_NS_RAW_NAMED_FE(ns, zend_name, name, arg_info) ZEND_NS_RAW_FENTRY(ns, #zend_name, name, arg_info, 0)

View File

@ -18,12 +18,16 @@ function func_get_args(): array {}
function strlen(string $string): int {}
/** @compile-time-eval */
function strcmp(string $string1, string $string2): int {}
/** @compile-time-eval */
function strncmp(string $string1, string $string2, int $length): int {}
/** @compile-time-eval */
function strcasecmp(string $string1, string $string2): int {}
/** @compile-time-eval */
function strncasecmp(string $string1, string $string2, int $length): int {}
function error_reporting(?int $error_level = null): int {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: f87d92c002674c431827895a8d8b3a5da3b95482 */
* Stub hash: 69dcb08ae12b6acbba872f7de5018ca5c0aaf669 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_version, 0, 0, IS_STRING, 0)
ZEND_END_ARG_INFO()
@ -283,10 +283,10 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(func_get_arg, arginfo_func_get_arg)
ZEND_FE(func_get_args, arginfo_func_get_args)
ZEND_FE(strlen, arginfo_strlen)
ZEND_FE(strcmp, arginfo_strcmp)
ZEND_FE(strncmp, arginfo_strncmp)
ZEND_FE(strcasecmp, arginfo_strcasecmp)
ZEND_FE(strncasecmp, arginfo_strncasecmp)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(strcmp, arginfo_strcmp)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(strncmp, arginfo_strncmp)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(strcasecmp, arginfo_strcasecmp)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(strncasecmp, arginfo_strncasecmp)
ZEND_FE(error_reporting, arginfo_error_reporting)
ZEND_FE(define, arginfo_define)
ZEND_FE(defined, arginfo_defined)

View File

@ -301,7 +301,7 @@ typedef struct _zend_oparray_context {
/* Class cannot be serialized or unserialized | | | */
#define ZEND_ACC_NOT_SERIALIZABLE (1 << 29) /* X | | | */
/* | | | */
/* Function Flags (unused: 27-30) | | | */
/* Function Flags (unused: 28-30) | | | */
/* ============== | | | */
/* | | | */
/* deprecation flag | | | */
@ -357,6 +357,9 @@ typedef struct _zend_oparray_context {
/* method flag used by Closure::__invoke() (int only) | | | */
#define ZEND_ACC_USER_ARG_INFO (1 << 26) /* | X | | */
/* | | | */
/* supports opcache compile-time evaluation (funcs) | | | */
#define ZEND_ACC_COMPILE_TIME_EVAL (1 << 27) /* | X | | */
/* | | | */
/* op_array uses strict mode types | | | */
#define ZEND_ACC_STRICT_TYPES (1U << 31) /* | X | | */

View File

@ -959,6 +959,8 @@ class FuncInfo {
/** @var bool */
public $isDeprecated;
/** @var bool */
public $supportsCompileTimeEval;
/** @var bool */
public $verify;
/** @var ArgInfo[] */
public $args;
@ -979,6 +981,7 @@ class FuncInfo {
?string $aliasType,
?FunctionOrMethodName $alias,
bool $isDeprecated,
bool $supportsCompileTimeEval,
bool $verify,
array $args,
ReturnInfo $return,
@ -991,6 +994,7 @@ class FuncInfo {
$this->aliasType = $aliasType;
$this->alias = $alias;
$this->isDeprecated = $isDeprecated;
$this->supportsCompileTimeEval = $supportsCompileTimeEval;
$this->verify = $verify;
$this->args = $args;
$this->return = $return;
@ -1155,6 +1159,10 @@ class FuncInfo {
"\tZEND_NS_FE(\"%s\", %s, %s)\n",
addslashes($namespace), $declarationName, $this->getArgInfoName());
} else {
if ($this->supportsCompileTimeEval) {
return sprintf(
"\tZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(%s, %s)\n", $declarationName, $this->getArgInfoName());
}
return sprintf("\tZEND_FE(%s, %s)\n", $declarationName, $this->getArgInfoName());
}
} else {
@ -2232,6 +2240,7 @@ function parseFunctionLike(
$aliasType = null;
$alias = null;
$isDeprecated = false;
$supportsCompileTimeEval = false;
$verify = true;
$docReturnType = null;
$tentativeReturnType = false;
@ -2267,6 +2276,8 @@ function parseFunctionLike(
$docParamTypes[$tag->getVariableName()] = $tag->getType();
} else if ($tag->name === 'refcount') {
$refcount = $tag->getValue();
} else if ($tag->name === 'compile-time-eval') {
$supportsCompileTimeEval = true;
}
}
}
@ -2355,6 +2366,7 @@ function parseFunctionLike(
$aliasType,
$alias,
$isDeprecated,
$supportsCompileTimeEval,
$verify,
$args,
$return,

View File

@ -35,6 +35,7 @@ function preg_replace_callback_array(array $pattern, string|array $subject, int
*/
function preg_split(string $pattern, string $subject, int $limit = -1, int $flags = 0): array|false {}
/** @compile-time-eval */
function preg_quote(string $str, ?string $delimiter = null): string {}
/** @refcount 1 */

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: bc6f31ac17d4f5d1a60dd3dad5f671058f40a224 */
* Stub hash: 39a19378fb1f1aca34bfdd483f5d3095558f0e09 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_match, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
@ -84,7 +84,7 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(preg_replace_callback, arginfo_preg_replace_callback)
ZEND_FE(preg_replace_callback_array, arginfo_preg_replace_callback_array)
ZEND_FE(preg_split, arginfo_preg_split)
ZEND_FE(preg_quote, arginfo_preg_quote)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(preg_quote, arginfo_preg_quote)
ZEND_FE(preg_grep, arginfo_preg_grep)
ZEND_FE(preg_last_error, arginfo_preg_last_error)
ZEND_FE(preg_last_error_msg, arginfo_preg_last_error_msg)

View File

@ -126,8 +126,10 @@ function pos(array|object $array): mixed {}
function key(array|object $array): int|string|null {}
/** @compile-time-eval */
function min(mixed $value, mixed ...$values): mixed {}
/** @compile-time-eval */
function max(mixed $value, mixed ...$values): mixed {}
/** @return true */
@ -136,8 +138,14 @@ function array_walk(array|object &$array, callable $callback, mixed $arg = UNKNO
/** @return true */
function array_walk_recursive(array|object &$array, callable $callback, mixed $arg = UNKNOWN): bool {}
/**
* @compile-time-eval
*/
function in_array(mixed $needle, array $haystack, bool $strict = false): bool {}
/**
* @compile-time-eval
*/
function array_search(mixed $needle, array $haystack, bool $strict = false): int|string|false {}
/** @prefer-ref $array */
@ -176,24 +184,48 @@ function array_splice(array &$array, int $offset, ?int $length = null, mixed $re
function array_slice(array $array, int $offset, ?int $length = null, bool $preserve_keys = false): array {}
/**
* @compile-time-eval
*/
function array_merge(array ...$arrays): array {}
/**
* @compile-time-eval
*/
function array_merge_recursive(array ...$arrays): array {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function array_replace(array $array, array ...$replacements): array {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function array_replace_recursive(array $array, array ...$replacements): array {}
/** @return array<int, int|string> */
/**
* @return array<int, int|string>
* @compile-time-eval
*/
function array_keys(array $array, mixed $filter_value = UNKNOWN, bool $strict = false): array {}
/**
* @compile-time-eval
*/
function array_key_first(array $array): int|string|null {}
/**
* @compile-time-eval
*/
function array_key_last(array $array): int|string|null {}
/** @return array<int, mixed|ref> */
/**
* @return array<int, mixed|ref>
* @compile-time-eval
*/
function array_values(array $array): array {}
/**
@ -213,12 +245,19 @@ function array_pad(array $array, int $length, mixed $value): array {}
/**
* @return array<int|string, int|string>
* @refcount 1
* @compile-time-eval
*/
function array_flip(array $array): array {}
/** @refcount 1 */
/**
* @refcount 1
* @compile-time-eval
*/
function array_change_key_case(array $array, int $case = CASE_LOWER): array {}
/**
* @compile-time-eval
*/
function array_unique(array $array, int $flags = SORT_STRING): array {}
/** @refcount 1 */
@ -260,15 +299,22 @@ function array_intersect_uassoc(array $array, ...$rest): array {}
*/
function array_uintersect_uassoc(array $array, ...$rest): array {}
/** @refcount 1 */
/**
* @refcount 1
* @compile-time-eval
*/
function array_diff_key(array $array, array ...$arrays): array {}
/**
* @param array|callable $rest
* @refcount 1
* @compile-time-eval
*/
function array_diff_ukey(array $array, ...$rest): array {}
/**
* @compile-time-eval
*/
function array_diff(array $array, array ...$arrays): array {}
/**
@ -277,7 +323,10 @@ function array_diff(array $array, array ...$arrays): array {}
*/
function array_udiff(array $array, ...$rest): array {}
/** @refcount 1 */
/**
* @refcount 1
* @compile-time-eval
*/
function array_diff_assoc(array $array, array ...$arrays): array {}
/**
@ -336,10 +385,16 @@ function array_is_list(array $array): bool {}
/* base64.c */
/** @refcount 1 */
/**
* @refcount 1
* @compile-time-eval
*/
function base64_encode(string $string): string {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function base64_decode(string $string, bool $strict = false): string|false {}
/* basic_functions.c */
@ -517,6 +572,7 @@ function get_browser(?string $user_agent = null, bool $return_array = false): ob
/* crc32.c */
/** @compile-time-eval */
function crc32(string $string): int {}
/* crypt.c */
@ -708,10 +764,16 @@ function assert_options(int $option, mixed $value = UNKNOWN): mixed {}
/* string.c */
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function bin2hex(string $string): string {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function hex2bin(string $string): string|false {}
function strspn(string $string, string $characters, int $offset = 0, ?int $length = null): int {}
@ -725,13 +787,16 @@ function nl_langinfo(int $item): string|false {}
function strcoll(string $string1, string $string2): int {}
/** @compile-time-eval */
function trim(string $string, string $characters = " \n\r\t\v\0"): string {}
/** @compile-time-eval */
function rtrim(string $string, string $characters = " \n\r\t\v\0"): string {}
/** @alias rtrim */
function chop(string $string, string $characters = " \n\r\t\v\0"): string {}
/** @compile-time-eval */
function ltrim(string $string, string $characters = " \n\r\t\v\0"): string {}
/** @refcount 1 */
@ -740,9 +805,13 @@ function wordwrap(string $string, int $width = 75, string $break = "\n", bool $c
/**
* @return array<int, string>
* @refcount 1
* @compile-time-eval
*/
function explode(string $separator, string $string, int $limit = PHP_INT_MAX): array {}
/**
* @compile-time-eval
*/
function implode(string|array $separator, ?array $array = null): string {}
/** @alias implode */
@ -751,8 +820,10 @@ function join(string|array $separator, ?array $array = null): string {}
/** @refcount 1 */
function strtok(string $string, ?string $token = null): string|false {}
/** @compile-time-eval */
function strtoupper(string $string): string {}
/** @compile-time-eval */
function strtolower(string $string): string {}
/** @refcount 1 */
@ -776,26 +847,34 @@ function strstr(string $haystack, string $needle, bool $before_needle = false):
/** @alias strstr */
function strchr(string $haystack, string $needle, bool $before_needle = false): string|false {}
/** @compile-time-eval */
function strpos(string $haystack, string $needle, int $offset = 0): int|false {}
/** @compile-time-eval */
function stripos(string $haystack, string $needle, int $offset = 0): int|false {}
/** @compile-time-eval */
function strrpos(string $haystack, string $needle, int $offset = 0): int|false {}
/** @compile-time-eval */
function strripos(string $haystack, string $needle, int $offset = 0): int|false {}
/** @refcount 1 */
function strrchr(string $haystack, string $needle): string|false {}
/** @compile-time-eval */
function str_contains(string $haystack, string $needle): bool {}
/** @compile-time-eval */
function str_starts_with(string $haystack, string $needle): bool {}
/** @compile-time-eval */
function str_ends_with(string $haystack, string $needle): bool {}
/** @refcount 1 */
function chunk_split(string $string, int $length = 76, string $separator = "\r\n"): string {}
/** @compile-time-eval */
function substr(string $string, int $offset, ?int $length = null): string {}
/** @return string|array<int|string, string> */
@ -804,21 +883,33 @@ function substr_replace(array|string $string, array|string $replace, array|int $
/** @refcount 1 */
function quotemeta(string $string): string {}
/** @compile-time-eval */
function ord(string $character): int {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function chr(int $codepoint): string {}
/** @compile-time-eval */
function ucfirst(string $string): string {}
/** @compile-time-eval */
function lcfirst(string $string): string {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function ucwords(string $string, string $separators = " \t\r\n\f\v"): string {}
function strtr(string $string, string|array $from, ?string $to = null): string {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function strrev(string $string): string {}
/** @param float $percent */
@ -837,12 +928,14 @@ function stripslashes(string $string): string {}
/**
* @param int $count
* @return string|array<int|string, string>
* @compile-time-eval
*/
function str_replace(array|string $search, array|string $replace, string|array $subject, &$count = null): string|array {}
/**
* @param int $count
* @return string|array<int|string, string>
* @compile-time-eval
*/
function str_ireplace(array|string $search, array|string $replace, string|array $subject, &$count = null): string|array {}
@ -913,6 +1006,7 @@ function str_word_count(string $string, int $format = 0, ?string $characters = n
/**
* @return array<int, string>
* @refcount 1
* @compile-time-eval
*/
function str_split(string $string, int $length = 1): array {}
@ -1324,16 +1418,25 @@ function getimagesizefromstring(string $string, &$image_info = null): array|fals
/** @return true */
function phpinfo(int $flags = INFO_ALL): bool {} // make return type void
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function phpversion(?string $extension = null): string|false {}
/** @return true */
function phpcredits(int $flags = CREDITS_ALL): bool {} // make return type void
function phpcredits(int $flags = CREDITS_ALL): bool {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function php_sapi_name(): string|false {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function php_uname(string $mode = "a"): string {}
/** @refcount 1 */
@ -1414,16 +1517,22 @@ function expm1(float $num): float {}
function log1p(float $num): float {}
/** @compile-time-eval */
function pi(): float {}
/** @compile-time-eval */
function is_finite(float $num): bool {}
/** @compile-time-eval */
function is_nan(float $num): bool {}
/** @compile-time-eval */
function intdiv(int $num1, int $num2): int {}
/** @compile-time-eval */
function is_infinite(float $num): bool {}
/** @compile-time-eval */
function pow(mixed $num, mixed $exponent): int|float|object {}
function exp(float $num): float {}
@ -1440,19 +1549,31 @@ function deg2rad(float $num): float {}
function rad2deg(float $num): float {}
/** @compile-time-eval */
function bindec(string $binary_string): int|float {}
/** @compile-time-eval */
function hexdec(string $hex_string): int|float {}
/** @compile-time-eval */
function octdec(string $octal_string): int|float {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function decbin(int $num): string {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function decoct(int $num): string {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function dechex(int $num): string {}
/** @refcount 1 */
@ -1847,16 +1968,28 @@ function uniqid(string $prefix = "", bool $more_entropy = false): string {}
*/
function parse_url(string $url, int $component = -1): int|string|array|null|false {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function urlencode(string $string): string {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function urldecode(string $string): string {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function rawurlencode(string $string): string {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function rawurldecode(string $string): string {}
/**
@ -1911,7 +2044,10 @@ function var_export(mixed $value, bool $return = false): ?string {}
function debug_zval_dump(mixed $value, mixed ...$values): void {}
/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function serialize(mixed $value): string {}
function unserialize(string $data, array $options = []): mixed {}
@ -1922,6 +2058,7 @@ function memory_get_peak_usage(bool $real_usage = false): int {}
/* versioning.c */
/** @compile-time-eval */
function version_compare(string $version1, string $version2, ?string $operator = null): int|bool {}
/* win32/codepage.c */

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 96393b26861733e5c7fc9a12095a29c07ed73928 */
* Stub hash: 0191861a660a4055650879e5a0dafd0853a6776b */
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)
@ -2888,12 +2888,12 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(current, arginfo_current)
ZEND_FALIAS(pos, current, arginfo_pos)
ZEND_FE(key, arginfo_key)
ZEND_FE(min, arginfo_min)
ZEND_FE(max, arginfo_max)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(min, arginfo_min)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(max, arginfo_max)
ZEND_FE(array_walk, arginfo_array_walk)
ZEND_FE(array_walk_recursive, arginfo_array_walk_recursive)
ZEND_FE(in_array, arginfo_in_array)
ZEND_FE(array_search, arginfo_array_search)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(in_array, arginfo_in_array)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_search, arginfo_array_search)
ZEND_FE(extract, arginfo_extract)
ZEND_FE(compact, arginfo_compact)
ZEND_FE(array_fill, arginfo_array_fill)
@ -2905,21 +2905,21 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(array_unshift, arginfo_array_unshift)
ZEND_FE(array_splice, arginfo_array_splice)
ZEND_FE(array_slice, arginfo_array_slice)
ZEND_FE(array_merge, arginfo_array_merge)
ZEND_FE(array_merge_recursive, arginfo_array_merge_recursive)
ZEND_FE(array_replace, arginfo_array_replace)
ZEND_FE(array_replace_recursive, arginfo_array_replace_recursive)
ZEND_FE(array_keys, arginfo_array_keys)
ZEND_FE(array_key_first, arginfo_array_key_first)
ZEND_FE(array_key_last, arginfo_array_key_last)
ZEND_FE(array_values, arginfo_array_values)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_merge, arginfo_array_merge)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_merge_recursive, arginfo_array_merge_recursive)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_replace, arginfo_array_replace)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_replace_recursive, arginfo_array_replace_recursive)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_keys, arginfo_array_keys)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_key_first, arginfo_array_key_first)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_key_last, arginfo_array_key_last)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_values, arginfo_array_values)
ZEND_FE(array_count_values, arginfo_array_count_values)
ZEND_FE(array_column, arginfo_array_column)
ZEND_FE(array_reverse, arginfo_array_reverse)
ZEND_FE(array_pad, arginfo_array_pad)
ZEND_FE(array_flip, arginfo_array_flip)
ZEND_FE(array_change_key_case, arginfo_array_change_key_case)
ZEND_FE(array_unique, arginfo_array_unique)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_flip, arginfo_array_flip)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_change_key_case, arginfo_array_change_key_case)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_unique, arginfo_array_unique)
ZEND_FE(array_intersect_key, arginfo_array_intersect_key)
ZEND_FE(array_intersect_ukey, arginfo_array_intersect_ukey)
ZEND_FE(array_intersect, arginfo_array_intersect)
@ -2928,11 +2928,11 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(array_uintersect_assoc, arginfo_array_uintersect_assoc)
ZEND_FE(array_intersect_uassoc, arginfo_array_intersect_uassoc)
ZEND_FE(array_uintersect_uassoc, arginfo_array_uintersect_uassoc)
ZEND_FE(array_diff_key, arginfo_array_diff_key)
ZEND_FE(array_diff_ukey, arginfo_array_diff_ukey)
ZEND_FE(array_diff, arginfo_array_diff)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_diff_key, arginfo_array_diff_key)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_diff_ukey, arginfo_array_diff_ukey)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_diff, arginfo_array_diff)
ZEND_FE(array_udiff, arginfo_array_udiff)
ZEND_FE(array_diff_assoc, arginfo_array_diff_assoc)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(array_diff_assoc, arginfo_array_diff_assoc)
ZEND_FE(array_diff_uassoc, arginfo_array_diff_uassoc)
ZEND_FE(array_udiff_assoc, arginfo_array_udiff_assoc)
ZEND_FE(array_udiff_uassoc, arginfo_array_udiff_uassoc)
@ -2948,8 +2948,8 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(array_chunk, arginfo_array_chunk)
ZEND_FE(array_combine, arginfo_array_combine)
ZEND_FE(array_is_list, arginfo_array_is_list)
ZEND_FE(base64_encode, arginfo_base64_encode)
ZEND_FE(base64_decode, arginfo_base64_decode)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(base64_encode, arginfo_base64_encode)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(base64_decode, arginfo_base64_decode)
ZEND_FE(constant, arginfo_constant)
ZEND_FE(ip2long, arginfo_ip2long)
ZEND_FE(long2ip, arginfo_long2ip)
@ -3017,7 +3017,7 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(sys_getloadavg, arginfo_sys_getloadavg)
#endif
ZEND_FE(get_browser, arginfo_get_browser)
ZEND_FE(crc32, arginfo_crc32)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(crc32, arginfo_crc32)
ZEND_FE(crypt, arginfo_crypt)
#if HAVE_STRPTIME
ZEND_DEP_FE(strptime, arginfo_strptime)
@ -3090,57 +3090,57 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(get_html_translation_table, arginfo_get_html_translation_table)
ZEND_FE(assert, arginfo_assert)
ZEND_FE(assert_options, arginfo_assert_options)
ZEND_FE(bin2hex, arginfo_bin2hex)
ZEND_FE(hex2bin, arginfo_hex2bin)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(bin2hex, arginfo_bin2hex)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(hex2bin, arginfo_hex2bin)
ZEND_FE(strspn, arginfo_strspn)
ZEND_FE(strcspn, arginfo_strcspn)
#if HAVE_NL_LANGINFO
ZEND_FE(nl_langinfo, arginfo_nl_langinfo)
#endif
ZEND_FE(strcoll, arginfo_strcoll)
ZEND_FE(trim, arginfo_trim)
ZEND_FE(rtrim, arginfo_rtrim)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(trim, arginfo_trim)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(rtrim, arginfo_rtrim)
ZEND_FALIAS(chop, rtrim, arginfo_chop)
ZEND_FE(ltrim, arginfo_ltrim)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(ltrim, arginfo_ltrim)
ZEND_FE(wordwrap, arginfo_wordwrap)
ZEND_FE(explode, arginfo_explode)
ZEND_FE(implode, arginfo_implode)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(explode, arginfo_explode)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(implode, arginfo_implode)
ZEND_FALIAS(join, implode, arginfo_join)
ZEND_FE(strtok, arginfo_strtok)
ZEND_FE(strtoupper, arginfo_strtoupper)
ZEND_FE(strtolower, arginfo_strtolower)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(strtoupper, arginfo_strtoupper)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(strtolower, arginfo_strtolower)
ZEND_FE(basename, arginfo_basename)
ZEND_FE(dirname, arginfo_dirname)
ZEND_FE(pathinfo, arginfo_pathinfo)
ZEND_FE(stristr, arginfo_stristr)
ZEND_FE(strstr, arginfo_strstr)
ZEND_FALIAS(strchr, strstr, arginfo_strchr)
ZEND_FE(strpos, arginfo_strpos)
ZEND_FE(stripos, arginfo_stripos)
ZEND_FE(strrpos, arginfo_strrpos)
ZEND_FE(strripos, arginfo_strripos)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(strpos, arginfo_strpos)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(stripos, arginfo_stripos)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(strrpos, arginfo_strrpos)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(strripos, arginfo_strripos)
ZEND_FE(strrchr, arginfo_strrchr)
ZEND_FE(str_contains, arginfo_str_contains)
ZEND_FE(str_starts_with, arginfo_str_starts_with)
ZEND_FE(str_ends_with, arginfo_str_ends_with)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(str_contains, arginfo_str_contains)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(str_starts_with, arginfo_str_starts_with)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(str_ends_with, arginfo_str_ends_with)
ZEND_FE(chunk_split, arginfo_chunk_split)
ZEND_FE(substr, arginfo_substr)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(substr, arginfo_substr)
ZEND_FE(substr_replace, arginfo_substr_replace)
ZEND_FE(quotemeta, arginfo_quotemeta)
ZEND_FE(ord, arginfo_ord)
ZEND_FE(chr, arginfo_chr)
ZEND_FE(ucfirst, arginfo_ucfirst)
ZEND_FE(lcfirst, arginfo_lcfirst)
ZEND_FE(ucwords, arginfo_ucwords)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(ord, arginfo_ord)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(chr, arginfo_chr)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(ucfirst, arginfo_ucfirst)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(lcfirst, arginfo_lcfirst)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(ucwords, arginfo_ucwords)
ZEND_FE(strtr, arginfo_strtr)
ZEND_FE(strrev, arginfo_strrev)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(strrev, arginfo_strrev)
ZEND_FE(similar_text, arginfo_similar_text)
ZEND_FE(addcslashes, arginfo_addcslashes)
ZEND_FE(addslashes, arginfo_addslashes)
ZEND_FE(stripcslashes, arginfo_stripcslashes)
ZEND_FE(stripslashes, arginfo_stripslashes)
ZEND_FE(str_replace, arginfo_str_replace)
ZEND_FE(str_ireplace, arginfo_str_ireplace)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(str_replace, arginfo_str_replace)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(str_ireplace, arginfo_str_ireplace)
ZEND_FE(hebrev, arginfo_hebrev)
ZEND_FE(nl2br, arginfo_nl2br)
ZEND_FE(strip_tags, arginfo_strip_tags)
@ -3158,7 +3158,7 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(str_rot13, arginfo_str_rot13)
ZEND_FE(str_shuffle, arginfo_str_shuffle)
ZEND_FE(str_word_count, arginfo_str_word_count)
ZEND_FE(str_split, arginfo_str_split)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(str_split, arginfo_str_split)
ZEND_FE(strpbrk, arginfo_strpbrk)
ZEND_FE(substr_compare, arginfo_substr_compare)
ZEND_FE(utf8_encode, arginfo_utf8_encode)
@ -3278,10 +3278,10 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(getimagesize, arginfo_getimagesize)
ZEND_FE(getimagesizefromstring, arginfo_getimagesizefromstring)
ZEND_FE(phpinfo, arginfo_phpinfo)
ZEND_FE(phpversion, arginfo_phpversion)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(phpversion, arginfo_phpversion)
ZEND_FE(phpcredits, arginfo_phpcredits)
ZEND_FE(php_sapi_name, arginfo_php_sapi_name)
ZEND_FE(php_uname, arginfo_php_uname)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(php_sapi_name, arginfo_php_sapi_name)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(php_uname, arginfo_php_uname)
ZEND_FE(php_ini_scanned_files, arginfo_php_ini_scanned_files)
ZEND_FE(php_ini_loaded_file, arginfo_php_ini_loaded_file)
ZEND_FE(iptcembed, arginfo_iptcembed)
@ -3319,12 +3319,12 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(acosh, arginfo_acosh)
ZEND_FE(expm1, arginfo_expm1)
ZEND_FE(log1p, arginfo_log1p)
ZEND_FE(pi, arginfo_pi)
ZEND_FE(is_finite, arginfo_is_finite)
ZEND_FE(is_nan, arginfo_is_nan)
ZEND_FE(intdiv, arginfo_intdiv)
ZEND_FE(is_infinite, arginfo_is_infinite)
ZEND_FE(pow, arginfo_pow)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(pi, arginfo_pi)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_finite, arginfo_is_finite)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_nan, arginfo_is_nan)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(intdiv, arginfo_intdiv)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(is_infinite, arginfo_is_infinite)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(pow, arginfo_pow)
ZEND_FE(exp, arginfo_exp)
ZEND_FE(log, arginfo_log)
ZEND_FE(log10, arginfo_log10)
@ -3332,12 +3332,12 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(hypot, arginfo_hypot)
ZEND_FE(deg2rad, arginfo_deg2rad)
ZEND_FE(rad2deg, arginfo_rad2deg)
ZEND_FE(bindec, arginfo_bindec)
ZEND_FE(hexdec, arginfo_hexdec)
ZEND_FE(octdec, arginfo_octdec)
ZEND_FE(decbin, arginfo_decbin)
ZEND_FE(decoct, arginfo_decoct)
ZEND_FE(dechex, arginfo_dechex)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(bindec, arginfo_bindec)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(hexdec, arginfo_hexdec)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(octdec, arginfo_octdec)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(decbin, arginfo_decbin)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(decoct, arginfo_decoct)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(dechex, arginfo_dechex)
ZEND_FE(base_convert, arginfo_base_convert)
ZEND_FE(number_format, arginfo_number_format)
ZEND_FE(fmod, arginfo_fmod)
@ -3459,10 +3459,10 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(uniqid, arginfo_uniqid)
#endif
ZEND_FE(parse_url, arginfo_parse_url)
ZEND_FE(urlencode, arginfo_urlencode)
ZEND_FE(urldecode, arginfo_urldecode)
ZEND_FE(rawurlencode, arginfo_rawurlencode)
ZEND_FE(rawurldecode, arginfo_rawurldecode)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(urlencode, arginfo_urlencode)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(urldecode, arginfo_urldecode)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(rawurlencode, arginfo_rawurlencode)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(rawurldecode, arginfo_rawurldecode)
ZEND_FE(get_headers, arginfo_get_headers)
ZEND_FE(stream_bucket_make_writeable, arginfo_stream_bucket_make_writeable)
ZEND_FE(stream_bucket_prepend, arginfo_stream_bucket_prepend)
@ -3475,11 +3475,11 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(var_dump, arginfo_var_dump)
ZEND_FE(var_export, arginfo_var_export)
ZEND_FE(debug_zval_dump, arginfo_debug_zval_dump)
ZEND_FE(serialize, arginfo_serialize)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(serialize, arginfo_serialize)
ZEND_FE(unserialize, arginfo_unserialize)
ZEND_FE(memory_get_usage, arginfo_memory_get_usage)
ZEND_FE(memory_get_peak_usage, arginfo_memory_get_peak_usage)
ZEND_FE(version_compare, arginfo_version_compare)
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(version_compare, arginfo_version_compare)
#if defined(PHP_WIN32)
ZEND_FE(sapi_windows_cp_set, arginfo_sapi_windows_cp_set)
#endif