mirror of
https://github.com/php/php-src.git
synced 2025-01-09 12:34:14 +08:00
Remove special chr/count handling in sccp function evaluation
These can be handled by the generic code. Worth noting that count will usually go through ZEND_COUNT, and chr on constants is evaluated in the compiler, so these are not particularly compile-time sensitive either.
This commit is contained in:
parent
924e875651
commit
c4334fc616
@ -787,23 +787,7 @@ static inline zend_result ct_eval_func_call(
|
||||
|
||||
if (num_args == 1) {
|
||||
/* Handle a few functions for which we manually implement evaluation here. */
|
||||
if (zend_string_equals_literal(name, "chr")) {
|
||||
zend_long c;
|
||||
if (Z_TYPE_P(args[0]) != IS_LONG) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
c = Z_LVAL_P(args[0]) & 0xff;
|
||||
ZVAL_CHAR(result, c);
|
||||
return SUCCESS;
|
||||
} else if (zend_string_equals_literal(name, "count")) {
|
||||
if (Z_TYPE_P(args[0]) != IS_ARRAY) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ZVAL_LONG(result, zend_hash_num_elements(Z_ARRVAL_P(args[0])));
|
||||
return SUCCESS;
|
||||
} else if (zend_string_equals_literal(name, "ini_get")) {
|
||||
if (zend_string_equals_literal(name, "ini_get")) {
|
||||
zend_ini_entry *ini_entry;
|
||||
|
||||
if (Z_TYPE_P(args[0]) != IS_STRING) {
|
||||
|
@ -82,6 +82,7 @@ function krsort(array &$array, int $flags = SORT_REGULAR): bool {}
|
||||
/** @return true */
|
||||
function ksort(array &$array, int $flags = SORT_REGULAR): bool {}
|
||||
|
||||
/** @compile-time-eval */
|
||||
function count(Countable|array $value, int $mode = COUNT_NORMAL): int {}
|
||||
|
||||
/** @alias count */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: cbba5dd593bba640750378c7d668b9e4ea6c979d */
|
||||
* Stub hash: ed5328c35c17c591847feba6cb00f5badb2b446c */
|
||||
|
||||
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)
|
||||
@ -2870,7 +2870,7 @@ static const zend_function_entry ext_functions[] = {
|
||||
ZEND_FE(array_push, arginfo_array_push)
|
||||
ZEND_FE(krsort, arginfo_krsort)
|
||||
ZEND_FE(ksort, arginfo_ksort)
|
||||
ZEND_FE(count, arginfo_count)
|
||||
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(count, arginfo_count)
|
||||
ZEND_FALIAS(sizeof, count, arginfo_sizeof)
|
||||
ZEND_FE(natsort, arginfo_natsort)
|
||||
ZEND_FE(natcasesort, arginfo_natcasesort)
|
||||
|
Loading…
Reference in New Issue
Block a user