Skip to content

Commit becd2e6

Browse files
authored
Merge pull request #15 from koolkode/Cleanup2
Internal Class / Function Attributes
2 parents 62102bb + 76fb079 commit becd2e6

File tree

3 files changed

+8
-37
lines changed

3 files changed

+8
-37
lines changed

Zend/zend_attributes.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,10 @@ ZEND_API zend_attribute *zend_get_parameter_attribute_str(HashTable *attributes,
8484
return get_attribute_str(attributes, str, len, offset + 1);
8585
}
8686

87-
static void attribute_ptr_dtor(zval *v) /* {{{ */
87+
static void attribute_ptr_dtor(zval *v)
8888
{
8989
zend_attribute_free((zend_attribute *) Z_PTR_P(v));
9090
}
91-
/* }}} */
9291

9392
ZEND_API void zend_compiler_attribute_register(zend_class_entry *ce, zend_attributes_internal_validator validator)
9493
{

Zend/zend_execute.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ ZEND_API const zend_internal_function zend_pass_function = {
137137
0, /* num_args */
138138
0, /* required_num_args */
139139
NULL, /* arg_info */
140+
NULL, /* attributes */
140141
ZEND_FN(pass), /* handler */
141142
NULL, /* module */
142-
{NULL,NULL,NULL,NULL,NULL} /* reserved */
143+
{NULL,NULL,NULL,NULL} /* reserved */
143144
};
144145

145146
#define FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_var) do { \

ext/reflection/php_reflection.c

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,17 +1767,9 @@ ZEND_METHOD(ReflectionFunctionAbstract, getAttributes)
17671767
reflection_object *intern;
17681768
zend_function *fptr;
17691769

1770-
HashTable *attributes = NULL;
1771-
zend_class_entry *scope = NULL;
1772-
17731770
GET_REFLECTION_OBJECT_PTR(fptr);
17741771

1775-
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.attributes) {
1776-
attributes = fptr->op_array.attributes;
1777-
scope = fptr->common.scope;
1778-
}
1779-
1780-
reflect_attributes(INTERNAL_FUNCTION_PARAM_PASSTHRU, attributes, 0, scope);
1772+
reflect_attributes(INTERNAL_FUNCTION_PARAM_PASSTHRU, fptr->common.attributes, 0, fptr->common.scope);
17811773
}
17821774
/* }}} */
17831775

@@ -2714,15 +2706,10 @@ ZEND_METHOD(ReflectionParameter, getAttributes)
27142706
reflection_object *intern;
27152707
parameter_reference *param;
27162708

2717-
HashTable *attributes = NULL;
2718-
zend_class_entry *scope = NULL;
2719-
27202709
GET_REFLECTION_OBJECT_PTR(param);
27212710

2722-
if (param->fptr->type == ZEND_USER_FUNCTION && param->fptr->op_array.attributes) {
2723-
attributes = param->fptr->op_array.attributes;
2724-
scope = param->fptr->common.scope;
2725-
}
2711+
HashTable *attributes = param->fptr->common.attributes;
2712+
zend_class_entry *scope = param->fptr->common.scope;
27262713

27272714
reflect_attributes(INTERNAL_FUNCTION_PARAM_PASSTHRU, attributes, param->offset + 1, scope);
27282715
}
@@ -3790,17 +3777,9 @@ ZEND_METHOD(ReflectionClassConstant, getAttributes)
37903777
reflection_object *intern;
37913778
zend_class_constant *ref;
37923779

3793-
HashTable *attributes = NULL;
3794-
zend_class_entry *scope = NULL;
3795-
37963780
GET_REFLECTION_OBJECT_PTR(ref);
37973781

3798-
if (ref->attributes) {
3799-
attributes = ref->attributes;
3800-
scope = ref->ce;
3801-
}
3802-
3803-
reflect_attributes(INTERNAL_FUNCTION_PARAM_PASSTHRU, attributes, 0, scope);
3782+
reflect_attributes(INTERNAL_FUNCTION_PARAM_PASSTHRU, ref->attributes, 0, ref->ce);
38043783
}
38053784
/* }}} */
38063785

@@ -5691,17 +5670,9 @@ ZEND_METHOD(ReflectionProperty, getAttributes)
56915670
reflection_object *intern;
56925671
property_reference *ref;
56935672

5694-
HashTable *attributes = NULL;
5695-
zend_class_entry *scope = NULL;
5696-
56975673
GET_REFLECTION_OBJECT_PTR(ref);
56985674

5699-
if (ref->prop->attributes) {
5700-
attributes = ref->prop->attributes;
5701-
scope = ref->prop->ce;
5702-
}
5703-
5704-
reflect_attributes(INTERNAL_FUNCTION_PARAM_PASSTHRU, attributes, 0, scope);
5675+
reflect_attributes(INTERNAL_FUNCTION_PARAM_PASSTHRU, ref->prop->attributes, 0, ref->prop->ce);
57055676
}
57065677
/* }}} */
57075678

0 commit comments

Comments
 (0)