diff options
| author | Felipe Pena <felipe@php.net> | 2010-05-29 22:08:51 +0000 |
|---|---|---|
| committer | Felipe Pena <felipe@php.net> | 2010-05-29 22:08:51 +0000 |
| commit | 2d63683ec3effbddd1a4a6ed5234822a58455198 (patch) | |
| tree | 8b9084f75fc4b3923dfd23be4b99ad6c6f110005 | |
| parent | 27c2c35953e3efb70b01872874eec4078a7be4f3 (diff) | |
| download | php-git-2d63683ec3effbddd1a4a6ed5234822a58455198.tar.gz | |
- Fixed ReflectionClass::isTrait() checking (to not identify abstract class as Trait)
| -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) |
