Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties) /* {{{ */
}
/* }}} */

static zend_class_mutable_data *zend_allocate_mutable_data(zend_class_entry *class_type) /* {{{ */
static zend_class_mutable_data *zend_allocate_mutable_data(const zend_class_entry *class_type) /* {{{ */
{
zend_class_mutable_data *mutable_data;

Expand All @@ -1434,7 +1434,7 @@ static zend_class_mutable_data *zend_allocate_mutable_data(zend_class_entry *cla
}
/* }}} */

ZEND_API HashTable *zend_separate_class_constants_table(zend_class_entry *class_type) /* {{{ */
ZEND_API HashTable *zend_separate_class_constants_table(const zend_class_entry *class_type) /* {{{ */
{
zend_class_mutable_data *mutable_data;
HashTable *constants_table;
Expand Down Expand Up @@ -5208,7 +5208,7 @@ ZEND_API zend_result zend_update_static_property_stringl(zend_class_entry *scope
}
/* }}} */

ZEND_API zval *zend_read_property_ex(zend_class_entry *scope, zend_object *object, zend_string *name, bool silent, zval *rv) /* {{{ */
ZEND_API zval *zend_read_property_ex(const zend_class_entry *scope, zend_object *object, zend_string *name, bool silent, zval *rv) /* {{{ */
{
zval *value;
const zend_class_entry *old_scope = EG(fake_scope);
Expand All @@ -5222,7 +5222,7 @@ ZEND_API zval *zend_read_property_ex(zend_class_entry *scope, zend_object *objec
}
/* }}} */

ZEND_API zval *zend_read_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, bool silent, zval *rv) /* {{{ */
ZEND_API zval *zend_read_property(const zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, bool silent, zval *rv) /* {{{ */
{
zval *value;
zend_string *str;
Expand Down
22 changes: 11 additions & 11 deletions Zend/zend_API.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,12 @@ ZEND_API void zend_declare_class_constant_string(zend_class_entry *ce, const cha

ZEND_API zend_result zend_update_class_constant(zend_class_constant *c, const zend_string *name, zend_class_entry *scope);
ZEND_API zend_result zend_update_class_constants(zend_class_entry *class_type);
ZEND_API HashTable *zend_separate_class_constants_table(zend_class_entry *class_type);
ZEND_API HashTable *zend_separate_class_constants_table(const zend_class_entry *class_type);

static zend_always_inline HashTable *zend_class_constants_table(zend_class_entry *ce) {
static zend_always_inline const HashTable *zend_class_constants_table(const zend_class_entry *ce) {
if ((ce->ce_flags & ZEND_ACC_HAS_AST_CONSTANTS) && ZEND_MAP_PTR(ce->mutable_data)) {
zend_class_mutable_data *mutable_data =
(zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
const zend_class_mutable_data *mutable_data =
(const zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
if (mutable_data && mutable_data->constants_table) {
return mutable_data->constants_table;
} else {
Expand All @@ -464,10 +464,10 @@ static zend_always_inline HashTable *zend_class_constants_table(zend_class_entry
}
}

static zend_always_inline zval *zend_class_default_properties_table(zend_class_entry *ce) {
static zend_always_inline zval *zend_class_default_properties_table(const zend_class_entry *ce) {
if ((ce->ce_flags & ZEND_ACC_HAS_AST_PROPERTIES) && ZEND_MAP_PTR(ce->mutable_data)) {
zend_class_mutable_data *mutable_data =
(zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
const zend_class_mutable_data *mutable_data =
(const zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
return mutable_data->default_properties_table;
} else {
return ce->default_properties_table;
Expand All @@ -484,10 +484,10 @@ static zend_always_inline void zend_class_set_backed_enum_table(zend_class_entry
}
}

static zend_always_inline HashTable *zend_class_backed_enum_table(zend_class_entry *ce)
static zend_always_inline HashTable *zend_class_backed_enum_table(const zend_class_entry *ce)
{
if (ZEND_MAP_PTR(ce->mutable_data) && ce->type == ZEND_USER_CLASS) {
zend_class_mutable_data *mutable_data = (zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
const zend_class_mutable_data *mutable_data = (const zend_class_mutable_data*)ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
return mutable_data->backed_enum_table;
} else {
return ce->backed_enum_table;
Expand All @@ -514,8 +514,8 @@ ZEND_API zend_result zend_update_static_property_double(zend_class_entry *scope,
ZEND_API zend_result zend_update_static_property_string(zend_class_entry *scope, const char *name, size_t name_length, const char *value);
ZEND_API zend_result zend_update_static_property_stringl(zend_class_entry *scope, const char *name, size_t name_length, const char *value, size_t value_length);

ZEND_API zval *zend_read_property_ex(zend_class_entry *scope, zend_object *object, zend_string *name, bool silent, zval *rv);
ZEND_API zval *zend_read_property(zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, bool silent, zval *rv);
ZEND_API zval *zend_read_property_ex(const zend_class_entry *scope, zend_object *object, zend_string *name, bool silent, zval *rv);
ZEND_API zval *zend_read_property(const zend_class_entry *scope, zend_object *object, const char *name, size_t name_length, bool silent, zval *rv);

ZEND_API zval *zend_read_static_property_ex(zend_class_entry *scope, zend_string *name, bool silent);
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t name_length, bool silent);
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ static zend_class_entry *zend_ast_fetch_class(zend_ast *ast, zend_class_entry *s
return zend_fetch_class_with_scope(zend_ast_get_str(ast), (ast->attr >> ZEND_CONST_EXPR_NEW_FETCH_TYPE_SHIFT) | ZEND_FETCH_CLASS_EXCEPTION, scope);
}

ZEND_API zend_result ZEND_FASTCALL zend_ast_evaluate_inner(
static zend_result ZEND_FASTCALL zend_ast_evaluate_inner(
zval *result,
zend_ast *ast,
zend_class_entry *scope,
Expand Down Expand Up @@ -589,7 +589,7 @@ ZEND_API zend_result ZEND_FASTCALL zend_ast_evaluate_ex(
return r;
}

ZEND_API zend_result ZEND_FASTCALL zend_ast_evaluate_inner(
static zend_result ZEND_FASTCALL zend_ast_evaluate_inner(
zval *result,
zend_ast *ast,
zend_class_entry *scope,
Expand Down
16 changes: 8 additions & 8 deletions Zend/zend_attributes.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ ZEND_METHOD(NoDiscard, __construct)
}
}

static zend_attribute *get_attribute(HashTable *attributes, zend_string *lcname, uint32_t offset)
static zend_attribute *get_attribute(const HashTable *attributes, const zend_string *lcname, uint32_t offset)
{
if (attributes) {
zend_attribute *attr;
Expand All @@ -261,7 +261,7 @@ static zend_attribute *get_attribute(HashTable *attributes, zend_string *lcname,
return NULL;
}

static zend_attribute *get_attribute_str(HashTable *attributes, const char *str, size_t len, uint32_t offset)
static zend_attribute *get_attribute_str(const HashTable *attributes, const char *str, size_t len, uint32_t offset)
{
if (attributes) {
zend_attribute *attr;
Expand All @@ -276,27 +276,27 @@ static zend_attribute *get_attribute_str(HashTable *attributes, const char *str,
return NULL;
}

ZEND_API zend_attribute *zend_get_attribute(HashTable *attributes, zend_string *lcname)
ZEND_API zend_attribute *zend_get_attribute(const HashTable *attributes, const zend_string *lcname)
{
return get_attribute(attributes, lcname, 0);
}

ZEND_API zend_attribute *zend_get_attribute_str(HashTable *attributes, const char *str, size_t len)
ZEND_API zend_attribute *zend_get_attribute_str(const HashTable *attributes, const char *str, size_t len)
{
return get_attribute_str(attributes, str, len, 0);
}

ZEND_API zend_attribute *zend_get_parameter_attribute(HashTable *attributes, zend_string *lcname, uint32_t offset)
ZEND_API zend_attribute *zend_get_parameter_attribute(const HashTable *attributes, const zend_string *lcname, uint32_t offset)
{
return get_attribute(attributes, lcname, offset + 1);
}

ZEND_API zend_attribute *zend_get_parameter_attribute_str(HashTable *attributes, const char *str, size_t len, uint32_t offset)
ZEND_API zend_attribute *zend_get_parameter_attribute_str(const HashTable *attributes, const char *str, size_t len, uint32_t offset)
{
return get_attribute_str(attributes, str, len, offset + 1);
}

ZEND_API zend_result zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope)
ZEND_API zend_result zend_get_attribute_value(zval *ret, const zend_attribute *attr, uint32_t i, zend_class_entry *scope)
{
if (i >= attr->argc) {
return FAILURE;
Expand Down Expand Up @@ -428,7 +428,7 @@ ZEND_API zend_string *zend_get_attribute_target_names(uint32_t flags)
return smart_str_extract(&str);
}

ZEND_API bool zend_is_attribute_repeated(HashTable *attributes, zend_attribute *attr)
ZEND_API bool zend_is_attribute_repeated(const HashTable *attributes, const zend_attribute *attr)
{
zend_attribute *other;

Expand Down
12 changes: 6 additions & 6 deletions Zend/zend_attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ typedef struct _zend_internal_attribute {
zend_string* (*validator)(zend_attribute *attr, uint32_t target, zend_class_entry *scope);
} zend_internal_attribute;

ZEND_API zend_attribute *zend_get_attribute(HashTable *attributes, zend_string *lcname);
ZEND_API zend_attribute *zend_get_attribute_str(HashTable *attributes, const char *str, size_t len);
ZEND_API zend_attribute *zend_get_attribute(const HashTable *attributes, const zend_string *lcname);
ZEND_API zend_attribute *zend_get_attribute_str(const HashTable *attributes, const char *str, size_t len);

ZEND_API zend_attribute *zend_get_parameter_attribute(HashTable *attributes, zend_string *lcname, uint32_t offset);
ZEND_API zend_attribute *zend_get_parameter_attribute_str(HashTable *attributes, const char *str, size_t len, uint32_t offset);
ZEND_API zend_attribute *zend_get_parameter_attribute(const HashTable *attributes, const zend_string *lcname, uint32_t offset);
ZEND_API zend_attribute *zend_get_parameter_attribute_str(const HashTable *attributes, const char *str, size_t len, uint32_t offset);

ZEND_API zend_result zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope);
ZEND_API zend_result zend_get_attribute_value(zval *ret, const zend_attribute *attr, uint32_t i, zend_class_entry *scope);
ZEND_API zend_result zend_get_attribute_object(zval *out, zend_class_entry *attribute_ce, zend_attribute *attribute_data, zend_class_entry *scope, zend_string *filename);

ZEND_API zend_string *zend_get_attribute_target_names(uint32_t targets);
ZEND_API bool zend_is_attribute_repeated(HashTable *attributes, zend_attribute *attr);
ZEND_API bool zend_is_attribute_repeated(const HashTable *attributes, const zend_attribute *attr);

ZEND_API zend_internal_attribute *zend_mark_internal_attribute(zend_class_entry *ce);
ZEND_API zend_internal_attribute *zend_internal_attribute_register(zend_class_entry *ce, uint32_t flags);
Expand Down
10 changes: 5 additions & 5 deletions Zend/zend_constants.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ ZEND_API zend_constant *_zend_get_special_const(const char *name, size_t len) /*
}
/* }}} */

ZEND_API bool zend_verify_const_access(zend_class_constant *c, zend_class_entry *scope) /* {{{ */
ZEND_API bool zend_verify_const_access(const zend_class_constant *c, const zend_class_entry *scope) /* {{{ */
{
if (ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_PUBLIC) {
return 1;
Expand Down Expand Up @@ -312,9 +312,9 @@ ZEND_API zval *zend_get_constant(zend_string *name)
return NULL;
}

ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *constant_name, zend_class_entry *scope, uint32_t flags)
ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *constant_name, const zend_class_entry *scope, uint32_t flags)
{
zend_class_entry *ce = NULL;
const zend_class_entry *ce = NULL;
zend_class_constant *c = NULL;
zval *ret_constant = NULL;

Expand Down Expand Up @@ -413,7 +413,7 @@ ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *
return ret_constant;
}

ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, uint32_t flags)
ZEND_API zval *zend_get_constant_ex(zend_string *cname, const zend_class_entry *scope, uint32_t flags)
{
zend_constant *c;
const char *colon;
Expand Down Expand Up @@ -492,7 +492,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
return &c->value;
}

static void* zend_hash_add_constant(HashTable *ht, zend_string *key, zend_constant *c)
static void* zend_hash_add_constant(HashTable *ht, zend_string *key, const zend_constant *c)
{
void *ret;
zend_constant *copy = pemalloc(sizeof(zend_constant), ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT);
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ void clean_module_constants(int module_number);
void free_zend_constant(zval *zv);
void zend_startup_constants(void);
void zend_register_standard_constants(void);
ZEND_API bool zend_verify_const_access(zend_class_constant *c, zend_class_entry *ce);
ZEND_API bool zend_verify_const_access(const zend_class_constant *c, const zend_class_entry *ce);
ZEND_API zval *zend_get_constant(zend_string *name);
ZEND_API zend_constant *zend_get_constant_ptr(zend_string *name);
ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len);
ZEND_API zval *zend_get_constant_ex(zend_string *name, zend_class_entry *scope, uint32_t flags);
ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *constant_name, zend_class_entry *scope, uint32_t flags);
ZEND_API zval *zend_get_constant_ex(zend_string *name, const zend_class_entry *scope, uint32_t flags);
ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *constant_name, const zend_class_entry *scope, uint32_t flags);
ZEND_API zend_constant *zend_register_bool_constant(const char *name, size_t name_len, bool bval, int flags, int module_number);
ZEND_API zend_constant *zend_register_null_constant(const char *name, size_t name_len, int flags, int module_number);
ZEND_API zend_constant *zend_register_long_constant(const char *name, size_t name_len, zend_long lval, int flags, int module_number);
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_execute_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,7 @@ void zend_unset_timeout(void) /* {{{ */
}
/* }}} */

static ZEND_COLD void report_class_fetch_error(zend_string *class_name, uint32_t fetch_type)
static ZEND_COLD void report_class_fetch_error(const zend_string *class_name, uint32_t fetch_type)
{
if (fetch_type & ZEND_FETCH_CLASS_SILENT) {
return;
Expand Down
2 changes: 1 addition & 1 deletion ext/reflection/php_reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -4839,7 +4839,7 @@ ZEND_METHOD(ReflectionClass, getConstant)
{
reflection_object *intern;
zend_class_entry *ce;
HashTable *constants_table;
const HashTable *constants_table;
zend_class_constant *c;
zend_string *name, *key;

Expand Down