summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2017-04-22 16:44:20 +0200
committerNikita Popov <nikita.ppv@gmail.com>2017-04-22 16:44:20 +0200
commitd5c6fcc3ba275c79da85537f9792e4eb3c6a0c39 (patch)
tree05e6d78205891aa5982beffa4a6b490a7450bbd5 /ext/reflection/php_reflection.c
parent0710eee043721cc0a6c36e40cbc19b5dc40933e6 (diff)
downloadphp-git-d5c6fcc3ba275c79da85537f9792e4eb3c6a0c39.tar.gz
Don't leak internal flags in reflection
If someone complains, we may re-expose specific flags while also adding corresponding class constants for them.
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index b9ae4d1c85..b8c984a8bf 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -3460,13 +3460,15 @@ ZEND_METHOD(reflection_method, getModifiers)
{
reflection_object *intern;
zend_function *mptr;
+ uint32_t keep_flags = ZEND_ACC_PPP_MASK | ZEND_ACC_IMPLICIT_PUBLIC
+ | ZEND_ACC_STATIC | ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(mptr);
- RETURN_LONG(mptr->common.fn_flags);
+ RETURN_LONG((mptr->common.fn_flags & keep_flags));
}
/* }}} */
@@ -4663,13 +4665,15 @@ ZEND_METHOD(reflection_class, getModifiers)
{
reflection_object *intern;
zend_class_entry *ce;
+ uint32_t keep_flags = ZEND_ACC_FINAL
+ | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(ce);
- RETURN_LONG(ce->ce_flags & ~(ZEND_ACC_CONSTANTS_UPDATED|ZEND_ACC_USE_GUARDS|ZEND_ACC_INHERITED));
+ RETURN_LONG((ce->ce_flags & keep_flags));
}
/* }}} */
@@ -5451,13 +5455,14 @@ ZEND_METHOD(reflection_property, getModifiers)
{
reflection_object *intern;
property_reference *ref;
+ uint32_t keep_flags = ZEND_ACC_PPP_MASK | ZEND_ACC_IMPLICIT_PUBLIC | ZEND_ACC_STATIC;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(ref);
- RETURN_LONG(ref->prop.flags);
+ RETURN_LONG((ref->prop.flags & keep_flags));
}
/* }}} */