Skip to content

Commit 205a14d

Browse files
-on_property_hook
1 parent 182ca9f commit 205a14d

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

ext/reflection/php_reflection.c

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ typedef struct _attribute_reference {
157157
zend_class_entry *scope;
158158
zend_string *filename;
159159
uint32_t target;
160-
bool on_property_hook;
161160
} attribute_reference;
162161

163162
typedef enum {
@@ -1255,7 +1254,7 @@ static void _extension_string(smart_str *str, const zend_module_entry *module, c
12551254

12561255
/* {{{ reflection_attribute_factory */
12571256
static void reflection_attribute_factory(zval *object, HashTable *attributes, zend_attribute *data,
1258-
zend_class_entry *scope, uint32_t target, zend_string *filename, bool on_property_hook)
1257+
zend_class_entry *scope, uint32_t target, zend_string *filename)
12591258
{
12601259
reflection_object *intern;
12611260
attribute_reference *reference;
@@ -1268,16 +1267,14 @@ static void reflection_attribute_factory(zval *object, HashTable *attributes, ze
12681267
reference->scope = scope;
12691268
reference->filename = filename ? zend_string_copy(filename) : NULL;
12701269
reference->target = target;
1271-
reference->on_property_hook = on_property_hook;
12721270
intern->ptr = reference;
12731271
intern->ref_type = REF_TYPE_ATTRIBUTE;
12741272
ZVAL_STR_COPY(reflection_prop_name(object), data->name);
12751273
}
12761274
/* }}} */
12771275

12781276
static int read_attributes(zval *ret, HashTable *attributes, zend_class_entry *scope,
1279-
uint32_t offset, uint32_t target, zend_string *name, zend_class_entry *base, zend_string *filename,
1280-
bool on_property_hook) /* {{{ */
1277+
uint32_t offset, uint32_t target, zend_string *name, zend_class_entry *base, zend_string *filename) /* {{{ */
12811278
{
12821279
ZEND_ASSERT(attributes != NULL);
12831280

@@ -1290,7 +1287,7 @@ static int read_attributes(zval *ret, HashTable *attributes, zend_class_entry *s
12901287

12911288
ZEND_HASH_PACKED_FOREACH_PTR(attributes, attr) {
12921289
if (attr->offset == offset && zend_string_equals(attr->lcname, filter)) {
1293-
reflection_attribute_factory(&tmp, attributes, attr, scope, target, filename, on_property_hook);
1290+
reflection_attribute_factory(&tmp, attributes, attr, scope, target, filename);
12941291
add_next_index_zval(ret, &tmp);
12951292
}
12961293
} ZEND_HASH_FOREACH_END();
@@ -1322,7 +1319,7 @@ static int read_attributes(zval *ret, HashTable *attributes, zend_class_entry *s
13221319
}
13231320
}
13241321

1325-
reflection_attribute_factory(&tmp, attributes, attr, scope, target, filename, on_property_hook);
1322+
reflection_attribute_factory(&tmp, attributes, attr, scope, target, filename);
13261323
add_next_index_zval(ret, &tmp);
13271324
} ZEND_HASH_FOREACH_END();
13281325

@@ -1331,7 +1328,7 @@ static int read_attributes(zval *ret, HashTable *attributes, zend_class_entry *s
13311328
/* }}} */
13321329

13331330
static void reflect_attributes(INTERNAL_FUNCTION_PARAMETERS, HashTable *attributes,
1334-
uint32_t offset, zend_class_entry *scope, uint32_t target, zend_string *filename, bool on_property_hook) /* {{{ */
1331+
uint32_t offset, zend_class_entry *scope, uint32_t target, zend_string *filename) /* {{{ */
13351332
{
13361333
zend_string *name = NULL;
13371334
zend_long flags = 0;
@@ -1364,7 +1361,7 @@ static void reflect_attributes(INTERNAL_FUNCTION_PARAMETERS, HashTable *attribut
13641361

13651362
array_init(return_value);
13661363

1367-
if (FAILURE == read_attributes(return_value, attributes, scope, offset, target, name, base, filename, on_property_hook)) {
1364+
if (FAILURE == read_attributes(return_value, attributes, scope, offset, target, name, base, filename)) {
13681365
RETURN_THROWS();
13691366
}
13701367
}
@@ -2069,21 +2066,15 @@ ZEND_METHOD(ReflectionFunctionAbstract, getAttributes)
20692066

20702067
GET_REFLECTION_OBJECT_PTR(fptr);
20712068

2072-
bool on_property_hook = false;
2073-
20742069
if (fptr->common.scope && (fptr->common.fn_flags & (ZEND_ACC_CLOSURE|ZEND_ACC_FAKE_CLOSURE)) != ZEND_ACC_CLOSURE) {
20752070
target = ZEND_ATTRIBUTE_TARGET_METHOD;
2076-
if (fptr->common.prop_info != NULL) {
2077-
on_property_hook = true;
2078-
}
20792071
} else {
20802072
target = ZEND_ATTRIBUTE_TARGET_FUNCTION;
20812073
}
20822074

20832075
reflect_attributes(INTERNAL_FUNCTION_PARAM_PASSTHRU,
20842076
fptr->common.attributes, 0, fptr->common.scope, target,
2085-
fptr->type == ZEND_USER_FUNCTION ? fptr->op_array.filename : NULL,
2086-
on_property_hook);
2077+
fptr->type == ZEND_USER_FUNCTION ? fptr->op_array.filename : NULL);
20872078
}
20882079
/* }}} */
20892080

@@ -2925,8 +2916,7 @@ ZEND_METHOD(ReflectionParameter, getAttributes)
29252916

29262917
reflect_attributes(INTERNAL_FUNCTION_PARAM_PASSTHRU,
29272918
attributes, param->offset + 1, scope, ZEND_ATTRIBUTE_TARGET_PARAMETER,
2928-
param->fptr->type == ZEND_USER_FUNCTION ? param->fptr->op_array.filename : NULL,
2929-
false);
2919+
param->fptr->type == ZEND_USER_FUNCTION ? param->fptr->op_array.filename : NULL);
29302920
}
29312921

29322922
/* {{{ Returns the index of the parameter, starting from 0 */
@@ -4048,8 +4038,7 @@ ZEND_METHOD(ReflectionClassConstant, getAttributes)
40484038

40494039
reflect_attributes(INTERNAL_FUNCTION_PARAM_PASSTHRU,
40504040
ref->attributes, 0, ref->ce, ZEND_ATTRIBUTE_TARGET_CLASS_CONST,
4051-
ref->ce->type == ZEND_USER_CLASS ? ref->ce->info.user.filename : NULL,
4052-
false);
4041+
ref->ce->type == ZEND_USER_CLASS ? ref->ce->info.user.filename : NULL);
40534042
}
40544043
/* }}} */
40554044

@@ -4454,8 +4443,7 @@ ZEND_METHOD(ReflectionClass, getAttributes)
44544443

44554444
reflect_attributes(INTERNAL_FUNCTION_PARAM_PASSTHRU,
44564445
ce->attributes, 0, ce, ZEND_ATTRIBUTE_TARGET_CLASS,
4457-
ce->type == ZEND_USER_CLASS ? ce->info.user.filename : NULL,
4458-
false);
4446+
ce->type == ZEND_USER_CLASS ? ce->info.user.filename : NULL);
44594447
}
44604448
/* }}} */
44614449

@@ -6402,8 +6390,7 @@ ZEND_METHOD(ReflectionProperty, getAttributes)
64026390

64036391
reflect_attributes(INTERNAL_FUNCTION_PARAM_PASSTHRU,
64046392
ref->prop->attributes, 0, ref->prop->ce, ZEND_ATTRIBUTE_TARGET_PROPERTY,
6405-
ref->prop->ce->type == ZEND_USER_CLASS ? ref->prop->ce->info.user.filename : NULL,
6406-
false);
6393+
ref->prop->ce->type == ZEND_USER_CLASS ? ref->prop->ce->info.user.filename : NULL);
64076394
}
64086395
/* }}} */
64096396

@@ -7911,7 +7898,7 @@ ZEND_METHOD(ReflectionConstant, getAttributes)
79117898

79127899
reflect_attributes(INTERNAL_FUNCTION_PARAM_PASSTHRU,
79137900
const_->attributes, 0, NULL, ZEND_ATTRIBUTE_TARGET_CONST,
7914-
const_->filename, false);
7901+
const_->filename);
79157902
}
79167903

79177904
ZEND_METHOD(ReflectionConstant, __toString)

0 commit comments

Comments
 (0)