diff options
| -rw-r--r-- | ext/reflection/php_reflection.c | 2 | ||||
| -rw-r--r-- | ext/reflection/tests/traits003.phpt | 30 |
2 files changed, 31 insertions, 1 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 2d8ba6e0c2..a590bf541d 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3999,7 +3999,7 @@ ZEND_METHOD(reflection_class, isInterface) Returns whether this is a trait */ ZEND_METHOD(reflection_class, isTrait) { - _class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_TRAIT); + _class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_TRAIT & ~ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); } /* }}} */ diff --git a/ext/reflection/tests/traits003.phpt b/ext/reflection/tests/traits003.phpt new file mode 100644 index 0000000000..c569a8e723 --- /dev/null +++ b/ext/reflection/tests/traits003.phpt @@ -0,0 +1,30 @@ +--TEST-- +Reflection and Traits +--FILE-- +<?php + +abstract class foo { +} + +trait bar { + +} + +final class baz { + +} + +$x = new ReflectionClass('foo'); +var_dump($x->isTrait()); + +$x = new ReflectionClass('bar'); +var_dump($x->isTrait()); + +$x = new ReflectionClass('baz'); +var_dump($x->isTrait()); + +?> +--EXPECT-- +bool(false) +bool(true) +bool(false) |
