mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Make sure SCCP can evaluate all functions pass1 can
Move evaluation of ini_get() into eval_special_func_call() and use this helper both in pass1 and sccp.
This commit is contained in:
parent
1050edaef8
commit
e45653c089
2 changed files with 16 additions and 21 deletions
|
@ -785,27 +785,9 @@ static inline zend_result ct_eval_func_call(
|
|||
return FAILURE;
|
||||
}
|
||||
|
||||
if (num_args == 1) {
|
||||
/* Handle a few functions for which we manually implement evaluation here. */
|
||||
if (zend_string_equals_literal(name, "ini_get")) {
|
||||
zend_ini_entry *ini_entry;
|
||||
|
||||
if (Z_TYPE_P(args[0]) != IS_STRING) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ini_entry = zend_hash_find_ptr(EG(ini_directives), Z_STR_P(args[0]));
|
||||
if (!ini_entry) {
|
||||
ZVAL_FALSE(result);
|
||||
} else if (ini_entry->modifiable != ZEND_INI_SYSTEM) {
|
||||
return FAILURE;
|
||||
} else if (ini_entry->value) {
|
||||
ZVAL_STR_COPY(result, ini_entry->value);
|
||||
} else {
|
||||
ZVAL_EMPTY_STRING(result);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
if (num_args == 1 && Z_TYPE_P(args[0]) == IS_STRING &&
|
||||
zend_optimizer_eval_special_func_call(result, name, Z_STR_P(args[0])) == SUCCESS) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (!can_ct_eval_func_call(func, name, num_args, args)) {
|
||||
|
|
|
@ -181,6 +181,19 @@ zend_result zend_optimizer_eval_special_func_call(
|
|||
zend_string_release_ex(dirname, 0);
|
||||
return FAILURE;
|
||||
}
|
||||
if (zend_string_equals_literal(name, "ini_get")) {
|
||||
zend_ini_entry *ini_entry = zend_hash_find_ptr(EG(ini_directives), arg);
|
||||
if (!ini_entry) {
|
||||
ZVAL_FALSE(result);
|
||||
} else if (ini_entry->modifiable != ZEND_INI_SYSTEM) {
|
||||
return FAILURE;
|
||||
} else if (ini_entry->value) {
|
||||
ZVAL_STR_COPY(result, ini_entry->value);
|
||||
} else {
|
||||
ZVAL_EMPTY_STRING(result);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue